NAME
Jedi::Request - Request object
VERSION
version 1.008
DESCRIPTION
This object is pass through the route, as a second params. (self, request, response).
You can get data from it, to generate your response
ATTRIBUTES
env
The environment variable, as it received from PSGI. This is a HASH.
path
The end of the path_info, without the road.
Ex: road("/test"), route("/me") # so /test/me/ will give the path /me/
The $ENV{PATH_INFO} is untouch, you can use that method to get the relative PATH.
The path always end with '/'.
params
If method is POST or PUT, it will parse the body, and extract the params.
Otherwise it parse the QUERY_STRING.
It always return an HASH, with:
key => Scalar // [ARRAY of Values]
Ex:
a=1&a=2&a=3&b=4&b=5&b=6&c=1
You receive:
{
a => [1,2,3],
b => [4,5,6],
c => 1
}
uploads
Return the file uploads.
For a request like test@test.txt, the form is :
test => {
filename "test.txt",
headers {
Content-Disposition "form-data; name="test"; filename="test.txt"",
Content-Type "text/plain"
},
name "test",
size 13,
tempname "/var/folders/_1/097rrrdd2s5dwqgd7hp6nlx00000gn/T/X4me5HO7L_.txt"
}
Ex with curl :
curl -F 'test@test.txt' http://localhost:5000/post
You can read the tempname file to get the content. When the request is sent back, the file is automatically removed.
See <HTTP::Body> for more details.
cookies
Parse the HTTP_COOKIE, and return an HASH of ARRAY
Ex:
a=1&b&c; b=4&5&6; c=1
You receive:
{
a => [1,2,3],
b => [4,5,6],
c => [1]
}
real_ip
Return a Net::IP::XS representation of the most probable real ip
remote_address
Return the int version of the real_ip
remote_address_str
Return the str version of the real_ip
base_url
Return the path path of the URL, without the params
url
Return the full path of the URL, without the params
METHODS
scheme
Return the scheme from proxied proto or main proto
base_host
Return the host:port proxied or real
port
Return the port part of the base_host
If no port found, it will return the default port based on scheme
host
Return the host part of the base_host
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/celogeek/perl-jedi/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
celogeek <me@celogeek.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.