sub handler {
capture {
MyModule->new->go;
} \$out;
my ($header, $body) = split /\r\n\r\n/, $out, 2;
my $h = HTTP::Headers->new;
for my $line (split /\r\n/, $header) {
my ($key, $value) = split /: /, $line, 2;
$h->header($key, $value);
}
$h->header('Status' => 200) unless $h->header('Status');
my $status = $h->header('Status');
$h->remove_header('Status');
print 'HTTP/1.1 '
. HTTP::Response->new($status => undef, $h, $body)->as_string("\r\n");
}
####
is $r->content, $post_data;
# Failed test at foobar.t line 85.
# got: ''
# expected: 'some post data'
# Looks like you failed 1 test of 8.
####
# HTTP/1.1 201 Created
# Location: http://localhost:12345
# Content-Type: text/html; charset=ISO-8859-1
# Client-Aborted: die
# Client-Date: Tue, 17 Feb 2009 18:16:12 GMT
# Client-Response-Num: 1
# X-Died: read failed: Connection reset by peer at .../LWP/Protocol/http.pm line 382, line 16.
#