File: new.t

package info (click to toggle)
libplack-perl 0.9989-1%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,556 kB
  • sloc: perl: 6,890; python: 6; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 715 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use strict;
use Test::More;
use Plack::Request;

my $req = Plack::Request->new({
    REQUEST_METHOD    => 'GET',
    SERVER_PROTOCOL   => 'HTTP/1.1',
    SERVER_PORT       => 80,
    SERVER_NAME       => 'example.com',
    SCRIPT_NAME       => '/foo',
    REMOTE_ADDR       => '127.0.0.1',
    'psgi.version'    => [ 1, 0 ],
    'psgi.input'      => undef,
    'psgi.errors'     => undef,
    'psgi.url_scheme' => 'http',
});

isa_ok($req, 'Plack::Request');

is($req->address, '127.0.0.1', 'address');
is($req->method, 'GET', 'method');
is($req->protocol, 'HTTP/1.1', 'protocol');
is($req->uri, 'http://example.com/foo', 'uri');
is($req->port, 80, 'port');
is($req->scheme, 'http', 'url_scheme');

done_testing();