| 1 |
use utf8; |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
|
| 5 |
use Test::More; |
| 6 |
use Plack::Test; |
| 7 |
use HTTP::Request::Common; |
| 8 |
use Encode; |
| 9 |
|
| 10 |
my $utf8 = 'ľščťžýáí'; |
| 11 |
|
| 12 |
{ |
| 13 |
package MyApp; |
| 14 |
|
| 15 |
use Dancer2; |
| 16 |
use utf8; |
| 17 |
|
| 18 |
get '/ľščťžýáí' => sub { |
| 19 |
return 'ľščťžýáí'; |
| 20 |
}; |
| 21 |
} |
| 22 |
|
| 23 |
my $app = Dancer2->psgi_app; |
| 24 |
|
| 25 |
test_psgi $app, sub { |
| 26 |
my $cb = shift; |
| 27 |
|
| 28 |
my $res = $cb->( GET '/ľščťžýáí' ); |
| 29 |
is $res->code, 200, 'route succeeded'; |
| 30 |
is Encode::decode('utf8', $res->content), 'ľščťžýáí', 'Correct content'; |
| 31 |
}; |
| 32 |
|
| 33 |
done_testing(); |