1use strict;
2use warnings;
3use t::Utils;
4use Test::More tests => 2;
5use HTTP::Engine;
6
7my $engine = HTTP::Engine->new(
8    interface => {
9        module => 'PSGI',
10        request_handler => sub {
11            my $req = shift;
12            is($req->content_type, 'application/x-test-req', 'request env');
13            my $res = HTTP::Engine::Response->new(
14                status  => 403,
15                body    => 'RET',
16                headers => { 'Content-Type' => 'application/x-test-ret' },
17            );
18            $res->headers->push_header('X-Foo' => 1);
19            $res->headers->push_header('X-Foo' => 2);
20            $res;
21        },
22    },
23);
24
25my $res = $engine->run({
26    CONTENT_TYPE => 'application/x-test-req',
27});
28
29is_deeply($res, [
30    403,
31    [
32        'Content-Length' => 3,
33        'Content-Type'   => 'application/x-test-ret',
34# PSGI spec says "The header MUST NOT contain a Status key".
35#       'Status'         => 403,
36        'X-Foo'          => 1,
37        'X-Foo'          => 2,
38    ],
39    [ 'RET' ],
40], 'response');
41