@@ -5,7 +5,7 @@ use utf8;
5
5
use Encode;
6
6
use Test::More import => [' !pass' ];
7
7
use Dancer::ModuleLoader;
8
- use LWP::UserAgent ;
8
+ use HTTP::Tiny ;
9
9
10
10
plan skip_all => " skip test with Test::TCP in win32/cygwin" if ($^O eq ' MSWin32' or $^O eq ' cygwin' );
11
11
plan skip_all => " Test::TCP is needed for this test"
@@ -19,16 +19,16 @@ Test::TCP::test_tcp(
19
19
my $res ;
20
20
21
21
$res = _get_http_response(GET => ' /string' , $port );
22
- is d($res -> content), " \x{1A9} " , " utf8 static response" ;
22
+ is d($res -> { content } ), " \x{1A9} " , " utf8 static response" ;
23
23
24
24
$res = _get_http_response(GET => ' /other/string' , $port );
25
- is d($res -> content), " \x{1A9} " , " utf8 response through forward" ;
25
+ is d($res -> { content } ), " \x{1A9} " , " utf8 response through forward" ;
26
26
27
27
$res = _get_http_response(GET => " /param/" .u(" \x{1A9} " ), $port );
28
- is d($res -> content), " \x{1A9} " , " utf8 route param" ;
28
+ is d($res -> { content } ), " \x{1A9} " , " utf8 route param" ;
29
29
30
30
$res = _get_http_response(GET => " /view?string1=" .u(" \x{E9} " ), $port );
31
- is d($res -> content), " sigma: 'Ʃ'\n pure_token: 'Ʃ'\n param_token: '\x{E9} '\n " ,
31
+ is d($res -> { content } ), " sigma: 'Ʃ'\n pure_token: 'Ʃ'\n param_token: '\x{E9} '\n " ,
32
32
" params and tokens are valid unicode" ;
33
33
},
34
34
server => sub {
@@ -60,8 +60,7 @@ sub d {
60
60
sub _get_http_response {
61
61
my ($method , $path , $port ) = @_ ;
62
62
63
- my $ua = LWP::UserAgent-> new;
64
- my $req = HTTP::Request-> new($method => " http://127.0.0.1:$port${path} " );
65
- return $ua -> request($req );
63
+ my $ua = HTTP::Tiny-> new;
64
+ return $ua -> request($method => " http://127.0.0.1:$port${path} " );
66
65
}
67
66
0 commit comments