Commit 2d26f016 authored by David Golden's avatar David Golden

test URL in response hashref

parent 97aec7e9
......@@ -75,6 +75,8 @@ for my $file ( dir_list("t/cases", qr/^get/ ) ) {
ok( ! $response->{success}, "$label success flag false" );
}
is ( $response->{url}, $url, "$label response URL" );
if (defined $case->{expected_headers}) {
my %expected = hashify( $case->{expected_headers} );
is_deeply($response->{headers}, \%expected, "$label expected headers");
......@@ -93,6 +95,8 @@ for my $file ( dir_list("t/cases", qr/^get/ ) ) {
}
;
if ( $options{data_callback} ) {
$check_expected->( $main::data, "$label cb got content" );
is ( $response->{content}, '', "$label resp content empty" );
......
......@@ -65,6 +65,11 @@ for my $file ( dir_list("t/cases", qr/^redirect/ ) ) {
? join("$CRLF", @{$case->{expected}}) : '';
is ( $response->{content}, $exp_content, "$label content" );
if ( $case->{expected_url} ) {
is ( $response->{url}, $case->{expected_url}[0], "$label response URL" );
}
}
done_testing;
......@@ -2,6 +2,8 @@ url
http://example.com/index.html
expected
abcdefghijklmnopqrstuvwxyz1234567890abcdef
expected_url
http://example.com/index2.html
----------
GET /index.html HTTP/1.1
Host: example.com
......
......@@ -4,6 +4,8 @@ url
http://example.com/index.html
expected
<a href="http://example.com/index2.html">redirect</a>
expected_url
http://example.com/index.html
----------
GET /index.html HTTP/1.1
Host: example.com
......
......@@ -4,6 +4,8 @@ url
http://example.com/index.html
expected
<a href="http://example.com/index3.html">redirect</a>
expected_url
http://example.com/index2.html
----------
GET /index.html HTTP/1.1
Host: example.com
......
......@@ -4,6 +4,8 @@ url
http://example.com/index.html
expected
abcdefghijklmnopqrstuvwxyz1234567890abcdef
expected_url
http://example.com/index3.html
----------
GET /index.html HTTP/1.1
Host: example.com
......
......@@ -2,6 +2,8 @@ url
http://example.com/index.html
expected
abcdefghijklmnopqrstuvwxyz1234567890abcdef
expected_url
http://example.com/index3.html
----------
GET /index.html HTTP/1.1
Host: example.com
......
......@@ -2,6 +2,8 @@ url
http://example.com/index.html
expected
abcdefghijklmnopqrstuvwxyz1234567890abcdef
expected_url
http://example.com/index2.html
----------
GET /index.html HTTP/1.1
Host: example.com
......
......@@ -2,6 +2,8 @@ url
http://example.com/index.html
expected
abcdefghijklmnopqrstuvwxyz1234567890abcdef
expected_url
http://example.com/index2.html
----------
GET /index.html HTTP/1.1
Host: example.com
......
......@@ -2,6 +2,8 @@ url
http://example.com/index.html
expected
<a href="http://example.com/index2.html">redirect</a>
expected_url
http://example.com/index.html
----------
GET /index.html HTTP/1.1
Host: example.com
......
......@@ -4,6 +4,8 @@ method
POST
expected
abcdefghijklmnopqrstuvwxyz1234567890abcdef
expected_url
http://example.com/index2.html
----------
POST /index.html HTTP/1.1
Host: example.com
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment