Commit | Line | Data |
457c1d76 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin '$Bin'; |
7 | use lib "$Bin/lib"; |
8 | |
b9548267 |
9 | use Test::More tests => 7; |
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', |
efa4a434 |
24 | ], User_Agent => 'perl/5', Content_Type => 'form-data'; |
a032b7f8 |
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 | ], |
01c35d4e |
39 | quux => [ undef, quux => Content => 4 ], |
d5bb451f |
40 | ], |
efa4a434 |
41 | User_Agent => 'perl/5', |
42 | Content_Type => 'form-data'; |
d5bb451f |
43 | |
01c35d4e |
44 | is($response->content, 'foo:1 bar:2 baz:3 quux:4', 'POST with file upload'); |
d5bb451f |
45 | |
f410f043 |
46 | $response = request '/cgi-bin/test_pathinfo.cgi/path/%2Finfo'; |
efa4a434 |
47 | is($response->content, '/path//info', 'PATH_INFO is correct'); |
0d83c5de |
48 | |
f410f043 |
49 | $response = request '/cgi-bin/test_filepathinfo.cgi/path/%2Finfo'; |
05f3f060 |
50 | is($response->content, '/test_filepath_info/path//info', |
51 | 'FILEPATH_INFO is correct'); |
f410f043 |
52 | |
17a050f8 |
53 | $response = request '/cgi-bin/mtfnpy/test_scriptname.cgi/foo/bar'; |
54 | is($response->content, '/cgi-bin/mtfnpy/test_scriptname.cgi', |
f410f043 |
55 | 'SCRIPT_NAME is correct'); |
b9548267 |
56 | |
c0c72ec2 |
57 | SKIP: { |
58 | require Catalyst; |
59 | |
60 | skip 'no $c->req->remote_user', 1 |
61 | if $Catalyst::VERSION < 5.80005; |
62 | |
63 | $ENV{REMOTE_USER} = 'TEST_USER'; |
5c7bf47d |
64 | $response = request( '/cgi-bin/test_remote_user.cgi', |
65 | { extra_env => { REMOTE_USER => 'TEST_USER' } }, |
66 | ); |
c0c72ec2 |
67 | is($response->content, 'TEST_USER', 'REMOTE_USER was passed'); |
68 | } |