Commit | Line | Data |
957088cd |
1 | use strict; |
2 | use warnings FATAL => 'all'; |
3 | use Test::More ( |
4 | eval { require HTTP::Request::AsCGI } |
5 | ? 'no_plan' |
6 | : (skip_all => 'No HTTP::Request::AsCGI') |
7 | ); |
8 | |
9 | |
10 | use HTTP::Request::Common qw(GET POST); |
11 | |
12 | require 'examples/bloggery/bloggery.cgi'; |
13 | |
14 | my $app = Bloggery->new( |
15 | { config => { posts_dir => 'examples/bloggery/posts' } } |
16 | ); |
17 | |
18 | sub run_request { |
19 | my $request = shift; |
20 | my $c = HTTP::Request::AsCGI->new($request)->setup; |
21 | $app->run; |
22 | $c->restore; |
23 | return $c->response; |
24 | } |
25 | |
26 | my $res; |
27 | |
39119082 |
28 | warn run_request(GET 'http://localhost/index.html')->as_string; |
957088cd |
29 | |
39119082 |
30 | warn run_request(GET 'http://localhost/')->as_string; |
957088cd |
31 | |
32 | warn run_request(GET 'http://localhost/One-Post.html')->as_string; |
33 | |
34 | warn run_request(GET 'http://localhost/Not-There.html')->as_string; |
35 | |
36 | warn run_request(POST 'http://localhost/One-Post.html')->as_string; |