In accordance with the documentation, I believe that callback should be called always. But when you set the content_length header, then the last callback is not invoked. Below is the test that shows this behavior.
#!/usr/bin/perl
use Mojolicious::Lite;
use Test::Mojo;
use Test::More;
get '/' => sub {
my $c = shift->render_later;
$c->res->headers->content_length(2);
$c->write('11', sub { app->defaults(qwe => 1234); $c->finish });
};
app->start;
my $t = Test::Mojo->new;
$t->get_ok('/')->status_is(200);
is app->defaults('qwe'), 1234;
done_testing;
I believe that this is a bug, since it's not documented.
In accordance with the documentation, I believe that callback should be called always. But when you set the content_length header, then the last callback is not invoked. Below is the test that shows this behavior.
I believe that this is a bug, since it's not documented.