diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-07-19 17:50:38 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-07-19 17:50:38 +0000 |
commit | d403562e3f7ac96df7cee2c1709ecd970b6c9761 (patch) | |
tree | 0c8ec1bc7a6e0bf408a0e183b52ef7de174cde9a /t/request.t | |
download | HTTP-Message-tarball-master.tar.gz |
HTTP-Message-6.10HEADHTTP-Message-6.10master
Diffstat (limited to 't/request.t')
-rw-r--r-- | t/request.t | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/t/request.t b/t/request.t new file mode 100644 index 0000000..44c3868 --- /dev/null +++ b/t/request.t @@ -0,0 +1,33 @@ +# Test extra HTTP::Request methods. Basic operation is tested in the +# message.t test suite. + +use strict; +use warnings; + +use Test::More; +plan tests => 11; + +use HTTP::Request; + +my $req = HTTP::Request->new(GET => "http://www.example.com"); +$req->accept_decodable; + +is($req->method, "GET"); +is($req->uri, "http://www.example.com"); +like($req->header("Accept-Encoding"), qr/\bgzip\b/); # assuming IO::Uncompress::Gunzip is there + +$req->dump(prefix => "# "); + +is($req->method("DELETE"), "GET"); +is($req->method, "DELETE"); + +is($req->uri("http:"), "http://www.example.com"); +is($req->uri, "http:"); + +$req->protocol("HTTP/1.1"); + +my $r2 = HTTP::Request->parse($req->as_string); +is($r2->method, "DELETE"); +is($r2->uri, "http:"); +is($r2->protocol, "HTTP/1.1"); +is($r2->header("Accept-Encoding"), $req->header("Accept-Encoding")); |