Last active
March 7, 2017 15:26
-
-
Save jberger/0bcfa64392078959f20b6a7e2fbdb8fd to your computer and use it in GitHub Desktop.
Remove the body of a static response after being built
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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