Skip to content

Instantly share code, notes, and snippets.

@ysasaki
Created March 8, 2010 05:40
Show Gist options
  • Save ysasaki/324903 to your computer and use it in GitHub Desktop.
Save ysasaki/324903 to your computer and use it in GitHub Desktop.
Mojolicious - change response code and content_type
package MyApp::Example;
use strict;
use warnings;
use base 'Mojolicious::Controller';
sub default {
my $self = shift;
# to text/plain
$self->res->headers->content_type('text/plain');
# change status code
$self->res->code(403);
$self->render_text('403 in plain text');
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment