summaryrefslogtreecommitdiffhomepage
path: root/test/perl/variables/psgi.pl
blob: c0a61b679634e0088cbf785cabffd414a6f33e82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
my $app = sub {
    my ($environ) = @_;

    my $len = int($environ->{'CONTENT_LENGTH'});
    $environ->{'psgi.input'}->read(my $body, $len);

    return ['200', [
        'Content-Type' => $environ->{'CONTENT_TYPE'},
        'Content-Length' => $len,
        'Request-Method' => $environ->{'REQUEST_METHOD'},
        'Request-Uri' => $environ->{'REQUEST_URI'},
        'Http-Host' => $environ->{'HTTP_HOST'},
        'Server-Protocol' => $environ->{'SERVER_PROTOCOL'},
        'Custom-Header' => $environ->{'HTTP_CUSTOM_HEADER'}
    ], [$body]];
};