summary refs log tree commit diff
path: root/t/spore-response/body.t
blob: 26c7baf55e82e52c66b7c546ab77fee68529adf7 (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
28
29
30
31
32
33
34
use strict;
use warnings;
use Test::More;
use Net::HTTP::Spore::Response;
use URI;

sub r($) {
    my $res = Net::HTTP::Spore::Response->new(200);
    $res->body(@_);
    return $res->finalize->[2];
}

sub raw($) {
    my $res = Net::HTTP::Spore::Response->new(200);
    $res->raw_body(@_);
    return $res->raw_body;
}

sub content($) {
    my $res = Net::HTTP::Spore::Response->new(200);
    $res->body(@_);
    return $res->content;
}

is_deeply r "Hello World", "Hello World";
is_deeply r [ "Hello", "World" ], [ "Hello", "World" ];

is_deeply raw "Hello World", "Hello World";
is_deeply raw [ "Hello", "World" ], [ "Hello", "World" ];

is_deeply content "Hello World", "Hello World";
is_deeply content [ "Hello", "World" ], [ "Hello", "World" ];

done_testing;