File: unknown_response.t

package info (click to toggle)
libplack-perl 1.0051-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,484 kB
  • sloc: perl: 5,289; sh: 4; makefile: 4; javascript: 1
file content (20 lines) | stat: -rw-r--r-- 509 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;