Commit | Line | Data |
21a20b7e |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin '$Bin'; |
7 | use lib "$Bin/lib"; |
8 | |
06d193b4 |
9 | use Test::More tests => 9; |
21a20b7e |
10 | |
11 | use Catalyst::Test 'TestCGIBin'; |
12 | use HTTP::Request::Common; |
13 | |
46a4350c |
14 | # this should be ignored |
15 | $ENV{MOD_PERL} = "mod_perl/2.0"; |
16 | |
9cc2dd4c |
17 | my $response = request POST '/my-bin/path/test.pl', [ |
21a20b7e |
18 | foo => 'bar', |
19 | bar => 'baz' |
20 | ]; |
21 | |
22 | is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File'); |
23 | |
06d193b4 |
24 | $response = request '/my-bin/path/test.pl?foo=bar&bar=baz'; |
25 | |
26 | is($response->content, 'foo:bar bar:baz', |
27 | 'Perl CGI File invoked with query params'); |
28 | |
bdb35995 |
29 | $response = request POST '/my-bin/exit.pl', [ |
30 | name => 'world', |
31 | ]; |
32 | |
33 | is($response->content, 'hello world', 'POST to Perl CGI with exit()'); |
34 | |
35 | $response = request POST '/my-bin/exit.pl', [ |
36 | name => 'world', |
37 | exit => 17, |
38 | ]; |
39 | |
40 | is($response->code, 500, 'POST to Perl CGI with nonzero exit()'); |
41 | |
21a20b7e |
42 | $response = request POST '/cgihandler/dongs', [ |
43 | foo => 'bar', |
44 | bar => 'baz' |
45 | ]; |
46 | |
47 | is($response->content, 'foo:bar bar:baz', |
48 | 'POST to Perl CGI File through a forward'); |
49 | |
50 | $response = request POST '/cgihandler/mtfnpy', [ |
51 | foo => 'bar', |
52 | bar => 'baz' |
53 | ]; |
54 | |
55 | is($response->content, 'foo:bar bar:baz', |
56 | 'POST to Perl CGI File through a forward via cgi_action'); |
57 | |
63096ad1 |
58 | $response = request '/my-bin/path/testdata.pl'; |
fbaba9dd |
59 | is($response->content, "testing\n", |
60 | 'scripts with __DATA__ sections work'); |
61 | |
f410f043 |
62 | $response = request '/my-bin/pathinfo.pl/path/info'; |
63 | is($response->content, '/path/info', |
64 | 'PATH_INFO works'); |
65 | |
21a20b7e |
66 | SKIP: { |
67 | skip "Can't run shell scripts on non-*nix", 1 |
68 | if $^O eq 'MSWin32' || $^O eq 'VMS'; |
69 | |
9cc2dd4c |
70 | is(get('/my-bin/test.sh'), "Hello!\n", 'Non-Perl CGI File'); |
21a20b7e |
71 | } |