Skip to content

Commit

Permalink
add a failng test for #655
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Nov 27, 2020
1 parent 854de22 commit 58e8f44
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions t/Plack-Request/body-unbuffered.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use strict;
use warnings;
use Test::More;
use Plack::Test;
use Plack::Request;
use Plack::Util;
use HTTP::Request::Common;

my $app = sub {
my $env = shift;

$env->{'psgix.input.buffered'} = 0;

my $input = $env->{'psgi.input'};
$env->{'psgi.input'} = Plack::Util::inline_object
read => sub { $input->read(@_) };

my $req = Plack::Request->new($env);
is $req->content, '{}';

$req->new_response(200)->finalize;
};

test_psgi $app, sub {
my $cb = shift;

# empty Content-Type
my $req = POST "/";
$req->content_type("");
$req->content("{}");
$req->content_length(2);

my $res = $cb->($req);
ok $res->is_success or diag $res->as_string;
};

done_testing;

0 comments on commit 58e8f44

Please sign in to comment.