diff options
Diffstat (limited to 't/content.t')
-rw-r--r-- | t/content.t | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/t/content.t b/t/content.t index aa39a1e..eb636fd 100644 --- a/t/content.t +++ b/t/content.t @@ -6,9 +6,20 @@ use Plack::Test; use Web::Request; +my ($content_before, $content_after); + my $app = sub { - my $req = Web::Request->new_from_env(shift); - is $req->content, 'body'; + my $env = shift; + + my $req = Web::Request->new_from_env($env); + $content_before = $req->content; + + # emulate other PSGI apps that reads from input, but not reset + $env->{'psgi.input'}->read(my($dummy), $env->{CONTENT_LENGTH}, 0); + + $req = Web::Request->new_from_env($env); + $content_after = $req->content; + $req->new_response(status => 200)->finalize; }; @@ -19,7 +30,10 @@ test_psgi $app, sub { $req->content("body"); $req->content_type('text/plain'); $req->content_length(4); - $cb->($req); + my $res = $cb->($req); + ok($res->is_success) || diag $res->content; + is $content_before, "body"; + is $content_after, "body"; }; done_testing; |