Mojolicious-Plugin-PlackMiddleware
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/PlackMiddleware.pm view on Meta::CPAN
'PATH_INFO' => $url->path->to_string,
'REQUEST_URI' => $url->to_string,
'QUERY_STRING' => $url->query->to_string,
'psgi.url_scheme' => $base->scheme,
'psgi.version' => [1,1],
'psgi.errors' => *STDERR,
'psgi.input' => $body,
'psgi.multithread' => Plack::Util::FALSE,
'psgi.multiprocess' => Plack::Util::TRUE,
'psgi.run_once' => Plack::Util::FALSE,
'psgi.streaming' => Plack::Util::TRUE,
'psgi.nonblocking' => Plack::Util::FALSE,
};
}
### ---
### convert psgi res to mojo res
### ---
sub psgi_res_to_mojo_res {
my $psgi_res = shift;
my $mojo_res = Mojo::Message::Response->new;
xt/compat/longpolling_lite_app.t view on Meta::CPAN
# Delayed custom response
$stash = undef;
$t->app->plugins->once(before_dispatch => sub { $stash = shift->stash });
$t->get_ok('/longpoll/dynamic/delayed')->status_is(201)
->header_is(Server => 'Mojolicious (Perl)')
->header_like('Set-Cookie' => qr/baz=yada/)->content_is('Dynamic!');
is $stash->{finished}, 1, 'finish event has been emitted once';
ok $stash->{destroyed}, 'controller has been destroyed';
# Chunked response streaming with drain event
$stash = undef;
$t->app->plugins->once(before_dispatch => sub { $stash = shift->stash });
$t->get_ok('/stream')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('0123456789');
is $stash->{subscribers}, 0, 'no leaking subscribers';
ok $stash->{destroyed}, 'controller has been destroyed';
# Finish event timing and delayed rendering of template
$stash = undef;
$t->app->plugins->once(before_dispatch => sub { $stash = shift->stash });
( run in 0.413 second using v1.01-cache-2.11-cpan-4d50c553e7e )