| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use Test::More tests => 1; |
| 4 |
use Plack::Test; |
| 5 |
use HTTP::Request::Common; |
| 6 |
|
| 7 |
{ |
| 8 |
|
| 9 |
package App; |
| 10 |
use Dancer2; |
| 11 |
|
| 12 |
post '/forwards' => sub { |
| 13 |
forward('/still_contains_uploads'); |
| 14 |
}; |
| 15 |
|
| 16 |
any '/still_contains_uploads' => sub { |
| 17 |
my $upload = request->upload('testupload'); |
| 18 |
if ($upload) { |
| 19 |
return; |
| 20 |
} |
| 21 |
die 'failed'; |
| 22 |
}; |
| 23 |
} |
| 24 |
|
| 25 |
{ |
| 26 |
my $test = Plack::Test->create(App->to_app); |
| 27 |
|
| 28 |
my $response = $test->request( |
| 29 |
POST( |
| 30 |
'/forwards', |
| 31 |
Content_Type => 'form-data', |
| 32 |
Content => |
| 33 |
[testupload => [undef, 'testupload', Content => "testcontent"]] |
| 34 |
) |
| 35 |
); |
| 36 |
|
| 37 |
is($response->code, 200, 'Uploads survive forward'); |
| 38 |
} |
| 39 |
|
| 40 |
done_testing(); |