1HTTP::Message::PSGI(3)User Contributed Perl DocumentationHTTP::Message::PSGI(3)
2
3
4
6 HTTP::Message::PSGI - Converts HTTP::Request and HTTP::Response from/to
7 PSGI env and response
8
10 use HTTP::Message::PSGI;
11
12 # $req is HTTP::Request, $res is HTTP::Response
13 my $env = req_to_psgi($req);
14 my $res = res_from_psgi([ $status, $headers, $body ]);
15
16 # Adds methods to HTTP::Request/Response class as well
17 my $env = $req->to_psgi;
18 my $res = HTTP::Response->from_psgi([ $status, $headers, $body ]);
19
21 HTTP::Message::PSGI gives you convenient methods to convert an
22 HTTP::Request object to a PSGI env hash and convert a PSGI response
23 arrayref to a HTTP::Response object.
24
25 If you want the other way around, see Plack::Request and
26 Plack::Response.
27
29 req_to_psgi
30 my $env = req_to_psgi($req [, $key => $val ... ]);
31
32 Converts a HTTP::Request object into a PSGI env hash reference.
33
34 HTTP::Request::to_psgi
35 my $env = $req->to_psgi;
36
37 Same as "req_to_psgi" but an instance method in HTTP::Request.
38
39 res_from_psgi
40 my $res = res_from_psgi([ $status, $headers, $body ]);
41
42 Creates a HTTP::Response object from a PSGI response array ref.
43
44 HTTP::Response->from_psgi
45 my $res = HTTP::Response->from_psgi([ $status, $headers, $body ]);
46
47 Same as "res_from_psgi", but is a class method in HTTP::Response.
48
50 Tatsuhiko Miyagawa
51
53 HTTP::Request::AsCGI HTTP::Message Plack::Test
54
55
56
57perl v5.28.1 2018-02-10 HTTP::Message::PSGI(3)