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