.. and updated tests
[catagits/HTTP-Request-AsCGI.git] / t / 05env.t
CommitLineData
6f5fb9a7 1#!perl
2
3use Test::More tests => 8;
4
5use strict;
6use warnings;
7
8use IO::File;
9use HTTP::Request;
10use HTTP::Request::AsCGI;
11
12my $r = HTTP::Request->new( GET => 'http://www.host.com/cgi-bin/script.cgi?a=1&b=2' );
13my $c = HTTP::Request::AsCGI->new($r);
14$c->stdout( IO::File->new_from_fd( STDOUT->fileno, '>' ) );
15$c->stderr( IO::File->new_from_fd( STDERR->fileno, '>' ) );
16
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{QUERY_STRING}, 'a=1&b=2', 'QUERY_STRING' );
878085c8 22is( $ENV{SCRIPT_NAME}, '/', 'SCRIPT_NAME' );
6f5fb9a7 23is( $ENV{REQUEST_METHOD}, 'GET', 'REQUEST_METHOD' );
24is( $ENV{SERVER_NAME}, 'www.host.com', 'SERVER_NAME' );
25is( $ENV{SERVER_PORT}, '80', 'SERVER_PORT' );
26
27$c->restore;
28
29is( $ENV{GATEWAY_INTERFACE}, undef, 'No CGI env after restore' );