summary refs log tree commit diff
path: root/t/spore-request/finalize.t
blob: 230c4164027042224c686ac47e729b697ddc8e30 (plain) (blame)
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 Net::HTTP::Spore::Request;

my $env = {
    REQUEST_METHOD  => 'GET',
    SERVER_NAME     => 'localhost',
    SERVER_PORT     => '80',
    SCRIPT_NAME     => '',
    PATH_INFO       => '/:database',
    REQUEST_URI     => '',
    QUERY_STRING    => '',
    SERVER_PROTOCOL => 'HTTP/1.0',
    'spore.params'  => [qw/database test_spore key foo rev 123/],
};

ok my $request = Net::HTTP::Spore::Request->new($env);

ok my $http_req = $request->finalize();
isa_ok($http_req, 'HTTP::Request');

is $env->{PATH_INFO}, '/test_spore';
is $env->{QUERY_STRING}, 'key=foo&rev=123';
is $http_req->uri->canonical, 'http://localhost/test_spore?key=foo&rev=123';

done_testing;