t/issues/vars-in-forward.t
raw| 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More tests => 2; |
| 4 | use Plack::Test; |
| 5 | use HTTP::Request::Common; |
| 6 | |
| 7 | { |
| 8 | package App; |
| 9 | use Dancer2; |
| 10 | get '/' => sub { |
| 11 | var foo => 'bar'; |
| 12 | forward '/next'; |
| 13 | }; |
| 14 | |
| 15 | get '/next' => sub { |
| 16 | vars->{'foo'}; |
| 17 | }; |
| 18 | } |
| 19 | |
| 20 | my $test = Plack::Test->create( App->to_app ); |
| 21 | my $res = $test->request( GET '/' ); |
| 22 | |
| 23 | ok( $res->is_success, 'Successful response' ); |
| 24 | is( $res->content, 'bar', 'Correct response' ); |