HTTP-Response-CGI
view release on metacpan or search on metacpan
t/parse-cgi.t view on Meta::CPAN
use Test::More tests => 10;
use HTTP::Response::CGI;
# Example test values.
my @headers = (
'Content-type: text/html',
'X-Forwarded-For: 127.0.0.1',
);
my $body = 'This is the body.';
my $output;
my $response;
# Test: default status (200 OK)
$output = join( "\n", @headers ) . "\n\n" . $body;
$response = HTTP::Response::CGI->parse($output);
is( $response->protocol, undef , 'protocol is undefined when not given');
t/parse-regular-http.t view on Meta::CPAN
# Parse normal HTTP output
# (to ensure that we're not breaking the parent HTTP::Response functionality)
use HTTP::Response::CGI;
# Example test values.
my $status = 'HTTP/1.1 200 OK';
my @headers = (
'Content-type: text/html',
'X-Forwarded-For: 127.0.0.1',
);
my $body = 'This is the body.';
my $output;
my $response;
$output = $status . "\n" . join( "\n", @headers ) . "\n\n" . $body;
$response = HTTP::Response::CGI->parse($output);
is( $response->protocol, 'HTTP/1.1' );
is( $response->code, '200' );
t/parse-spacing.t view on Meta::CPAN
use Test::More tests => 10;
use HTTP::Response::CGI;
# Example test values.
my @headers = (
'Content-type: text/html',
'X-Forwarded-For: 127.0.0.1',
);
my $body = 'This is the body.';
my $output;
my $response;
# Test: regular newlines
$output = join( "\n", @headers ) . "\n\n" . $body;
$response = HTTP::Response::CGI->parse($output);
is( $response->protocol, undef , 'protocol is undefined when not given');
( run in 0.427 second using v1.01-cache-2.11-cpan-26ccb49234f )