Commit | Line | Data |
6f5fb9a7 |
1 | #!perl |
2 | |
090cc060 |
3 | use Test::More tests => 9; |
6f5fb9a7 |
4 | |
5 | use strict; |
6 | use warnings; |
7 | |
8 | use IO::File; |
9 | use HTTP::Request; |
10 | use HTTP::Request::AsCGI; |
11 | |
090cc060 |
12 | my $r = HTTP::Request->new( GET => 'http://www.host.com/my/path/?a=1&b=2' ); |
6f5fb9a7 |
13 | my $c = HTTP::Request::AsCGI->new($r); |
090cc060 |
14 | $c->stdout(undef); |
15 | $c->stderr(undef); |
6f5fb9a7 |
16 | |
17 | $c->setup; |
18 | |
19 | is( $ENV{GATEWAY_INTERFACE}, 'CGI/1.1', 'GATEWAY_INTERFACE' ); |
20 | is( $ENV{HTTP_HOST}, 'www.host.com:80', 'HTTP_HOST' ); |
090cc060 |
21 | is( $ENV{PATH_INFO}, '/my/path/', 'PATH_INFO' ); |
6f5fb9a7 |
22 | is( $ENV{QUERY_STRING}, 'a=1&b=2', 'QUERY_STRING' ); |
878085c8 |
23 | is( $ENV{SCRIPT_NAME}, '/', 'SCRIPT_NAME' ); |
6f5fb9a7 |
24 | is( $ENV{REQUEST_METHOD}, 'GET', 'REQUEST_METHOD' ); |
25 | is( $ENV{SERVER_NAME}, 'www.host.com', 'SERVER_NAME' ); |
26 | is( $ENV{SERVER_PORT}, '80', 'SERVER_PORT' ); |
27 | |
28 | $c->restore; |
29 | |
30 | is( $ENV{GATEWAY_INTERFACE}, undef, 'No CGI env after restore' ); |