root/lang/perl/HTTP-Engine/trunk/t/030_daemonize/proxy_path.t @ 18687

Revision 18687, 0.9 kB (checked in by tokuhirom, 5 years ago)

hmm... $req->uri->path returns different value between interface.

Line 
1use strict;
2use warnings;
3use t::Utils;
4use Test::More;
5
6plan tests => 2*interfaces;
7
8use LWP::UserAgent;
9use HTTP::Engine;
10
11daemonize_all sub {
12    my ($port, $interface) = @_;
13
14    my $ua = LWP::UserAgent->new(timeout => 10);
15    $ua->proxy('http', "http://localhost:$port/");
16    my $res = $ua->get("http://localhost:$port/?http=1");
17    is $res->code, 200, $interface;
18    is $res->content, '/'; # which one is best?
19} => <<'...';
20    sub {
21        my $port = shift;
22        return (
23            poe_kernel_run => 1,
24            interface => {
25                args => {
26                    port => $port,
27                },
28                request_handler => sub {
29                    my $req = shift;
30                    HTTP::Engine::Response->new(
31                        status => 200,
32                        body   => $req->uri->path,
33                    );
34                },
35            },
36        );
37    }
38...
39
Note: See TracBrowser for help on using the browser.