summaryrefslogtreecommitdiff
path: root/t/spore-middleware/redirection.t
blob: fe239f96815ec3b844e446a57f8e9ce8152d0a3f (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 warnings;

use Test::More;

plan tests => 2;

use Net::HTTP::Spore;

SKIP: {
    skip "require RUN_HTTP_TEST", 2 unless $ENV{RUN_HTTP_TEST};
    my $client = Net::HTTP::Spore->new_from_string(
        '{
    "base_url" : "http://fperrad.googlepages.com",
      "name"   : "googlepages",
      "methods"
      : { "get_home"
        : { "path" : "/home", "method" : "GET", "expected_status" : [200] } }
    }');

    $client->enable('Redirection');

    my $r = $client->get_home();
    is $r->status, 200;
    is $r->request->uri,
      'http://sites.google.com/site/fperrad/home';
}