summaryrefslogtreecommitdiffstats
path: root/t/new.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-07-18 16:22:08 -0500
committerJesse Luehrs <doy@tozt.net>2012-07-18 16:22:08 -0500
commitb5d66ba6e274eed251da951bb943b9ff67765290 (patch)
tree8b468f4ec6279a2d218f44d69a530c2a2476f1fc /t/new.t
parentbc67313aa7191255f4123ae8d89f890e2f0772bc (diff)
downloadweb-request-b5d66ba6e274eed251da951bb943b9ff67765290.tar.gz
web-request-b5d66ba6e274eed251da951bb943b9ff67765290.zip
import the Plack::Request test suite
Diffstat (limited to 't/new.t')
-rw-r--r--t/new.t30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/new.t b/t/new.t
new file mode 100644
index 0000000..46aff08
--- /dev/null
+++ b/t/new.t
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Web::Request;
+
+my $req = Web::Request->new_from_env({
+ 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, 'Web::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;