=== modified file 'lib/Net/Async/HTTP.pm'
--- lib/Net/Async/HTTP.pm 2013-09-22 01:52:31 +0000
+++ lib/Net/Async/HTTP.pm 2013-09-27 12:01:10 +0000
@@ -676,7 +676,7 @@
return Future->new->fail( "$code $message", $resp, $request );
}
- return $resp;
+ return $f;
});
}
=== modified file 't/04fail.t'
--- t/04fail.t 2013-09-10 00:28:12 +0000
+++ t/04fail.t 2013-09-27 12:01:10 +0000
@@ -114,6 +114,28 @@
is( $request_f->uri, "
http://host0/some/path", '$request_f->uri for fail_on_error true' );
is( $request_c->uri, "
http://host0/some/path", '$request_f->uri for fail_on_error true' );
+
+ # Now check that non-errors don't fail
+ $future = $http->do_request(
+ method => "GET",
+ uri => URI->new( "
http://host0/other/path" ),
+ );
+
+ $request_stream = "";
+ wait_for_stream { $request_stream =~ m/$CRLF$CRLF/ } $peersock => $request_stream;
+
+ $peersock->syswrite( join( $CRLF,
+ "HTTP/1.1 200 OK",
+ "Content-Type: text/plain",
+ "Content-Length: 9",
+ "" ) . $CRLF .
+ "Here I am"
+ );
+
+ wait_for { $future->is_ready };
+ my $response = $future->get;
+
+ is( $response->code, 200, '$response->code for non-fail' );
}
done_testing;