Mojolicious-Plugin-PlackMiddleware
view release on metacpan or search on metacpan
xt/compat/lite_app.t view on Meta::CPAN
$t->get_ok('/root')->status_is(200)->header_is(Server => 'Mojolicious (Perl)')
->content_is('root fallback!');
$t->get_ok('/root.txt')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('root fallback!');
# Root with format
$t->get_ok('/.html')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->content_is("/root.html\n/root.html\n/root.html\n/root.html\n/root.html\n");
# Reverse proxy with "X-Forwarded-For"
{
local $ENV{MOJO_REVERSE_PROXY} = 1;
$t->ua->server->restart;
$t->get_ok('/0' => {'X-Forwarded-For' => '192.0.2.2, 192.0.2.1'})
->status_is(200)->header_unlike('X-Original' => qr/192\.0\.2\.1/)
->content_like(qr!http://127\.0\.0\.1:\d+/0-192\.0\.2\.1-0$!);
}
# Reverse proxy with "X-Forwarded-Proto"
{
local $ENV{MOJO_REVERSE_PROXY} = 1;
$t->ua->server->restart;
$t->get_ok('/0' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_like(qr!^https://127\.0\.0\.1:\d+/0-!)->content_like(qr/-0$/)
->content_unlike(qr!-192\.0\.2\.1-0$!);
}
# "X-Forwarded-For"
$t->ua->server->restart;
$t->get_ok('/0' => {'X-Forwarded-For' => '192.0.2.2, 192.0.2.1'})
->status_is(200)->content_like(qr!^http://127\.0\.0\.1:\d+/0-!)
->content_like(qr/-0$/)->content_unlike(qr!-192\.0\.2\.1-0$!);
# "X-Forwarded-Proto"
$t->get_ok('/0' => {'X-Forwarded-Proto' => 'https'})->status_is(200)
->content_like(qr!^http://127\.0\.0\.1:\d+/0-!)->content_like(qr/-0$/)
->content_unlike(qr!-192\.0\.2\.1-0$!);
# Inline "epl" template
$t->delete_ok('/inline/epl')->status_is(200)->content_is("2 â\n");
( run in 0.450 second using v1.01-cache-2.11-cpan-4e96b696675 )