Commit | Line | Data |
457c1d76 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin '$Bin'; |
7 | use lib "$Bin/lib"; |
8 | |
d5bb451f |
9 | use Test::More tests => 6; |
457c1d76 |
10 | |
11 | use Catalyst::Test 'TestApp'; |
12 | use HTTP::Request::Common; |
13 | |
14 | my $response = request POST '/cgi-bin/test.cgi', [ |
15 | foo => 'bar', |
16 | bar => 'baz' |
17 | ]; |
18 | |
19 | is($response->content, 'foo:bar bar:baz', 'POST to CGI'); |
0d83c5de |
20 | |
a032b7f8 |
21 | $response = request POST '/cgi-bin/test.cgi', [ |
22 | foo => 'bar', |
23 | bar => 'baz', |
24 | ], 'Content-Type' => 'form-data'; |
25 | |
26 | is($response->content, 'foo:bar bar:baz', 'POST to CGI (form-data)'); |
27 | |
d5bb451f |
28 | $response = request POST '/cgi-bin/test.cgi', |
29 | Content => [ |
16db0bfc |
30 | foo => 1, |
31 | bar => 2, |
32 | baz => [ |
33 | undef, |
34 | 'baz', |
35 | 'Some-Header' => 'blah', |
36 | 'Content-Type' => 'text/plain', |
37 | Content => 3 |
38 | ], |
d5bb451f |
39 | ], |
40 | 'Content-Type' => 'form-data'; |
41 | |
16db0bfc |
42 | is($response->content, 'foo:1 bar:2 baz:3', 'POST with file upload'); |
d5bb451f |
43 | |
f410f043 |
44 | $response = request '/cgi-bin/test_pathinfo.cgi/path/%2Finfo'; |
8903042e |
45 | is($response->content, '/path/%2Finfo', 'PATH_INFO is correct'); |
0d83c5de |
46 | |
f410f043 |
47 | $response = request '/cgi-bin/test_filepathinfo.cgi/path/%2Finfo'; |
8903042e |
48 | is($response->content, '/test_filepath_info/path/%2Finfo', |
f410f043 |
49 | 'FILEPATH_INFO is correct (maybe)'); |
50 | |
51 | $response = request '/cgi-bin/test_scriptname.cgi/foo/bar'; |
52 | is($response->content, '/cgi-bin/test_scriptname.cgi', |
53 | 'SCRIPT_NAME is correct'); |