Compiler-Parser

 view release on metacpan or  search on metacpan

t/app/Plack/Request.t  view on Meta::CPAN

=item method

Contains the request method (C<GET>, C<POST>, C<HEAD>, etc).

=item protocol

Returns the protocol (HTTP/1.0 or HTTP/1.1) used for the current request.

=item request_uri

Returns the raw, undecoded request URI path. You probably do B<NOT>
want to use this to dispatch requests.

=item path_info

Returns B<PATH_INFO> in the environment. Use this to get the local
path for the requests.

=item path

Similar to C<path_info> but returns C</> in case it is empty. In other

t/app/Plack/Request.t  view on Meta::CPAN


Returns (optional) C<psgix.logger> code reference. When it exists,
your application is supposed to send the log message to this logger,
using:

  $req->logger->({ level => 'debug', message => "This is a debug message" });

=item cookies

Returns a reference to a hash containing the cookies. Values are
strings that are sent by clients and are URI decoded.

If there are multiple cookies with the same name in the request, this
method will ignore the duplicates and return only the first value. If
that causes issues for you, you may have to use modules like
CGI::Simple::Cookie to parse C<$request->header('Cookies')> by
yourself.

=item query_parameters

Returns a reference to a hash containing query string (GET)

t/app/Plack/Request.t  view on Meta::CPAN

request body (POST). As with C<query_parameters>, the hash
reference is a L<Hash::MultiValue> object.

=item parameters

Returns a L<Hash::MultiValue> hash reference containing (merged) GET
and POST parameters.

=item content, raw_body

Returns the request content in an undecoded byte string for POST requests.

=item uri

Returns an URI object for the current request. The URI is constructed
using various environment values such as C<SCRIPT_NAME>, C<PATH_INFO>,
C<QUERY_STRING>, C<HTTP_HOST>, C<SERVER_NAME> and C<SERVER_PORT>.

Every time this method is called it returns a new, cloned URI object.

=item base

t/app/Plack/Test/Suite.t  view on Meta::CPAN

                                                                                                                                                            left => branch { ',',
                                                                                                                                                                left => branch { '->',
                                                                                                                                                                    left => leaf '$res',
                                                                                                                                                                    right => function_call { 'content',
                                                                                                                                                                        args => [
                                                                                                                                                                        ],
                                                                                                                                                                    },
                                                                                                                                                                },
                                                                                                                                                                right => leaf '/foo/bar,baz',
                                                                                                                                                            },
                                                                                                                                                            right => leaf 'PATH_INFO should be decoded per RFC 3875',
                                                                                                                                                        },
                                                                                                                                                    ],
                                                                                                                                                },
                                                                                                                                            ],
                                                                                                                                        },
                                                                                                                                    },
                                                                                                                                    right => function { 'sub',
                                                                                                                                        body => [
                                                                                                                                            branch { '=',
                                                                                                                                                left => leaf '$env',

t/app/Plack/Test/Suite.t  view on Meta::CPAN

                                                                                                                                                        left => branch { ',',
                                                                                                                                                            left => branch { '->',
                                                                                                                                                                left => leaf '$res',
                                                                                                                                                                right => function_call { 'content',
                                                                                                                                                                    args => [
                                                                                                                                                                    ],
                                                                                                                                                                },
                                                                                                                                                            },
                                                                                                                                                            right => leaf '/foo/bar%2cbaz',
                                                                                                                                                        },
                                                                                                                                                        right => leaf 'PATH_INFO should be decoded only once, per RFC 3875',
                                                                                                                                                    },
                                                                                                                                                ],
                                                                                                                                            },
                                                                                                                                        ],
                                                                                                                                    },
                                                                                                                                },
                                                                                                                                right => function { 'sub',
                                                                                                                                    body => [
                                                                                                                                        branch { '=',
                                                                                                                                            left => leaf '$env',

t/app/Plack/Test/Suite.t  view on Meta::CPAN

                [ 'Content-Type' => 'text/plain', ],
                [$body],
            ];
        },
    ],
    [
        '% encoding in PATH_INFO',
        sub {
            my $cb  = shift;
            my $res = $cb->(GET "http://127.0.0.1/foo/bar%2cbaz");
            is $res->content, "/foo/bar,baz", "PATH_INFO should be decoded per RFC 3875";
        },
        sub {
            my $env = shift;
            return [
                200,
                [ 'Content-Type' => 'text/plain', ],
                [ $env->{PATH_INFO} ],
            ];
        },
    ],
    [
        '% double encoding in PATH_INFO',
        sub {
            my $cb  = shift;
            my $res = $cb->(GET "http://127.0.0.1/foo/bar%252cbaz");
            is $res->content, "/foo/bar%2cbaz", "PATH_INFO should be decoded only once, per RFC 3875";
        },
        sub {
            my $env = shift;
            return [
                200,
                [ 'Content-Type' => 'text/plain', ],
                [ $env->{PATH_INFO} ],
            ];
        },
    ],



( run in 0.271 second using v1.01-cache-2.11-cpan-26ccb49234f )