PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/t/020_interface/lighty-fcgi.t

http://github.com/http-engine/HTTP-Engine
Unknown | 43 lines | 37 code | 6 blank | 0 comment | 0 complexity | fa02328c461c46246d2c5a520c6b3fb0 MD5 | raw file
 1use strict;
 2use warnings;
 3use Test::More;
 4use LWP::UserAgent;
 5use t::FCGIUtils;
 6
 7# DO TESTS.
 8test_lighty(
 9    <<'...',
10#!/usr/bin/perl
11use strict;
12use warnings;
13use HTTP::Engine;
14use HTTP::Engine::Response;
15
16HTTP::Engine->new(
17    interface => {
18        module => 'FCGI',
19        args   => {
20            nproc => 1,
21        },
22        request_handler => sub {
23            my $req = shift;
24
25            HTTP::Engine::Response->new(
26                body => "OK",
27            );
28         }
29    },
30)->run;
31...
32    sub {
33        my ($port, ) = @_;
34
35        plan tests => 2;
36
37        my $ua = LWP::UserAgent->new();
38        my $res = $ua->get("http://localhost:$port/");
39        ok $res->is_success;
40        is $res->content, "OK";
41    },
42);
43