forked from plack/Plack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cgibin.t
29 lines (22 loc) · 805 Bytes
/
cgibin.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use Test::More;
use Test::Requires { 'CGI::Emulate::PSGI' => 0, 'CGI::Compile' => 0.03 };
use Plack::Test;
use HTTP::Request::Common;
use Plack::App::CGIBin;
my $app = Plack::App::CGIBin->new(root => "t/Plack-Middleware/cgi-bin")->to_app;
test_psgi app => $app, client => sub {
my $cb = shift;
my $res = $cb->(GET "http://localhost/hello.cgi?name=foo");
is $res->code, 200;
is $res->content, "Hello foo counter=1";
$res = $cb->(GET "http://localhost/hello.cgi?name=bar");
is $res->code, 200;
is $res->content, "Hello bar counter=2";
$res = $cb->(GET "http://localhost/hello2.cgi?name=foo");
is $res->code, 200;
is $res->content, "Hello foo counter=1";
$res = $cb->(GET "http://localhost/hello3.cgi");
is $res->code, 404;
};
done_testing;