avoid .git and dist files
[catagits/HTTP-Request-AsCGI.git] / t / deprecated / 08error.t
CommitLineData
9c216915 1#!perl
2
3use Test::More tests => 12;
4
5use strict;
6use warnings;
7
8use IO::File;
9use HTTP::Request;
10use HTTP::Request::AsCGI;
11
12my $response;
13
14{
15 my $r = HTTP::Request->new( GET => 'http://www.host.com/' );
16 my $c = HTTP::Request::AsCGI->new($r);
17
18 $c->setup;
19
20 $response = $c->restore->response;
21}
22
23isa_ok( $response, 'HTTP::Response' );
24is( $response->code, 500, 'Response Code' );
25is( $response->message, 'Internal Server Error', 'Response Message' );
26is( $response->protocol, 'HTTP/1.1', 'Response Protocol' );
27is( $response->content_type, 'text/html', 'Response Content-Type' );
28ok( length($response->content) > 0, 'Response Content' );
29
30{
31 my $r = HTTP::Request->new( GET => 'http://www.host.com/' );
32 my $c = HTTP::Request::AsCGI->new($r);
33
34 $c->setup;
35
36 print "Content-Type: text/plain\n";
37 print "Status: 500 Borked\n";
38 print "\n";
39 print "Borked!";
40
41 $response = $c->restore->response;
42}
43
44isa_ok( $response, 'HTTP::Response' );
45is( $response->code, 500, 'Response Code' );
46is( $response->message, 'Borked', 'Response Message' );
47is( $response->protocol, 'HTTP/1.1', 'Response Protocol' );
48is( $response->content_type, 'text/plain', 'Response Content-Type' );
49is( $response->content, 'Borked!', 'Response Content' );