Skip to content

Instantly share code, notes, and snippets.

@jberger
Last active March 7, 2017 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jberger/0bcfa64392078959f20b6a7e2fbdb8fd to your computer and use it in GitHub Desktop.
Save jberger/0bcfa64392078959f20b6a7e2fbdb8fd to your computer and use it in GitHub Desktop.
Remove the body of a static response after being built
use Mojolicious::Lite;
hook after_static => sub {
my $c = shift;
return if $c->req->headers->header('X-OK');
$c->res->content(Mojo::Content::Single->new);
$c->rendered(400);
};
app->start;
__DATA__
@@ index.txt
Hello world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment