/t/010_core/request-body.t
http://github.com/http-engine/HTTP-Engine · Raku · 27 lines · 22 code · 3 blank · 2 comment · 0 complexity · 1abb6d0b23505446875c98c1afea04a5 MD5 · raw file
- use strict;
- use warnings;
- use Test::More tests => 2;
- use t::Utils;
- use HTTP::Engine;
- use HTTP::Request;
- # prepare
- my $body = 'foo=bar';
- my $req = HTTP::Request->new(
- 'POST',
- '/',
- HTTP::Headers::Fast->new(
- 'content-length' => length($body),
- 'Content-Type' => 'application/x-www-form-urlencoded',
- ),
- $body,
- );
- # do test
- run_engine {
- my $req = shift;
- is $req->raw_body, 'foo=bar';
- is_deeply $req->body_params, { foo => 'bar' };
- return ok_response;
- } $req;