Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #437 from wchristian/http-msg-invalid-response
make HTTP::Message::PSGI complain loudly about invalid PSGI responses
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use HTTP::Message::PSGI; | ||
use HTTP::Request; | ||
use HTTP::Response; | ||
|
||
my $res; | ||
my $app = sub { $res }; | ||
my $env = req_to_psgi(HTTP::Request->new(GET => "http://localhost/")); | ||
|
||
eval { HTTP::Response->from_psgi($app->($env)) }; | ||
like($@, qr/Bad response undef/, 'converting undef PSGI response results in error'); | ||
|
||
$res = 5; | ||
|
||
eval { HTTP::Response->from_psgi($app->($env)) }; | ||
like($@, qr/Bad response '5'/, 'converting invalid PSGI response results in error'); | ||
|
||
done_testing; |