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