uri_unescape PATH_INFO
[catagits/HTTP-Request-AsCGI.git] / t / 05env.t
CommitLineData
6f5fb9a7 1#!perl
2
b332ee65 3use Test::More tests => 10;
6f5fb9a7 4
5use strict;
6use warnings;
7
6f5fb9a7 8use HTTP::Request;
9use HTTP::Request::AsCGI;
10
11454d47 11my $r = HTTP::Request->new( GET => 'http://www.host.com/cgi-bin/script.cgi/my%20path/?a=1&b=2', [ 'X-Test' => 'Test' ] );
b332ee65 12my %e = ( SCRIPT_NAME => '/cgi-bin/script.cgi' );
13my $c = HTTP::Request::AsCGI->new( $r, %e );
14$c->stdout(undef);
6f5fb9a7 15
16$c->setup;
17
18is( $ENV{GATEWAY_INTERFACE}, 'CGI/1.1', 'GATEWAY_INTERFACE' );
19is( $ENV{HTTP_HOST}, 'www.host.com:80', 'HTTP_HOST' );
30efa07d 20is( $ENV{HTTP_X_TEST}, 'Test', 'HTTP_X_TEST' );
11454d47 21is( $ENV{PATH_INFO}, '/my path/', 'PATH_INFO' );
6f5fb9a7 22is( $ENV{QUERY_STRING}, 'a=1&b=2', 'QUERY_STRING' );
ca38286c 23is( $ENV{SCRIPT_NAME}, '/cgi-bin/script.cgi', 'SCRIPT_NAME' );
6f5fb9a7 24is( $ENV{REQUEST_METHOD}, 'GET', 'REQUEST_METHOD' );
25is( $ENV{SERVER_NAME}, 'www.host.com', 'SERVER_NAME' );
26is( $ENV{SERVER_PORT}, '80', 'SERVER_PORT' );
27
28$c->restore;
29
30is( $ENV{GATEWAY_INTERFACE}, undef, 'No CGI env after restore' );