PageRenderTime 43ms CodeModel.GetById 30ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/t/010_core/request-body.t

http://github.com/http-engine/HTTP-Engine
Unknown | 27 lines | 24 code | 3 blank | 0 comment | 0 complexity | 1abb6d0b23505446875c98c1afea04a5 MD5 | raw file
 1use strict;
 2use warnings;
 3use Test::More tests => 2;
 4use t::Utils;
 5use HTTP::Engine;
 6use HTTP::Request;
 7
 8# prepare
 9my $body = 'foo=bar';
10my $req = HTTP::Request->new(
11    'POST',
12    '/',
13    HTTP::Headers::Fast->new(
14        'content-length' => length($body),
15        'Content-Type' => 'application/x-www-form-urlencoded',
16    ),
17    $body,
18);
19
20# do test
21run_engine {
22    my $req = shift;
23    is $req->raw_body, 'foo=bar';
24    is_deeply $req->body_params, { foo => 'bar' };
25    return ok_response;
26} $req;
27