eval
"use 5.008"
;
plan
skip_all
=>
"$@"
if
$@;
plan
skip_all
=>
'not supported anymore'
;
my
$env
;
$env
->{REQUEST_METHOD} =
'GET'
;
$env
->{QUERY_STRING} =
'game=chess&game=checkers&weather=dull'
;
$env
->{PATH_INFO} =
'/somewhere/else'
;
$env
->{PATH_TRANSLATED} =
'/usr/local/somewhere/else'
;
$env
->{SCRIPT_NAME} =
'/cgi-bin/foo.cgi'
;
$env
->{SERVER_PROTOCOL} =
'HTTP/1.0'
;
$env
->{SERVER_PORT} = 8080;
$env
->{SERVER_NAME} =
'the.good.ship.lollypop.com'
;
$env
->{REQUEST_URI} =
"$env->{SCRIPT_NAME}$env->{PATH_INFO}?$env->{QUERY_STRING}"
;
$env
->{HTTP_LOVE} =
'true'
;
my
$header
= CGI::Header::PSGI->new(
query
=> CGI::PSGI->new(
$env
),
);
{
my
$test
=
'psgi_redirect($url)'
;
is(
$status
, 302,
"$test - default status"
);
}
{
my
$test
=
'psgi_redirect() with content type'
;
my
(
$status
,
$headers
) =
$header
->finalize;
is(
$status
, 302,
"$test - status"
);
is_deeply
$headers
, [
'Content-Type'
=>
'text/html; charset=ISO-8859-1'
,
],
"$test - headers array"
;
}
{
my
$test
=
"psgi_redirect() with path and query string"
;
my
(
$status
,
$headers
) =
$header
->finalize;
is(
$status
, 302,
"$test - status"
);
is_deeply
$headers
, [
'Content-Type'
=>
'text/html; charset=ISO-8859-1'
,
],
"$test - headers array"
;
}