Commit | Line | Data |
298a02df |
1 | use strict; |
2 | use warnings FATAL => 'all'; |
3 | |
4 | use Test::More ( |
5 | eval { require HTTP::Request::AsCGI } |
6 | ? 'no_plan' |
7 | : (skip_all => 'No HTTP::Request::AsCGI') |
8 | ); |
9 | |
10 | { |
11 | use Web::Simple 'EnvTest'; |
12 | package EnvTest; |
a61c443e |
13 | sub dispatch_request { |
298a02df |
14 | sub (GET) { |
a61c443e |
15 | my $env = $_[PSGI_ENV]; |
298a02df |
16 | [ 200, |
17 | [ "Content-type" => "text/plain" ], |
18 | [ 'foo' ] |
19 | ] |
20 | }, |
21 | } |
22 | } |
23 | |
24 | use HTTP::Request::Common qw(GET POST); |
25 | |
26 | my $app = EnvTest->new; |
27 | |
28 | sub run_request { |
29 | my $request = shift; |
30 | my $c = HTTP::Request::AsCGI->new($request)->setup; |
31 | $app->run; |
32 | $c->restore; |
33 | return $c->response; |
34 | } |
35 | |
c7b1c57f |
36 | ok run_request(GET 'http://localhost/')->is_success; |