Commit 06bb87b3 authored by David Golden's avatar David Golden

Add content callback test

parent fe56b620
......@@ -11,6 +11,7 @@ BEGIN { monkey_patch() }
my %response_codes = (
'new.txt' => '201',
'callback.txt' => '201',
);
for my $file ( dir_list("t/cases", qr/^put/ ) ) {
......@@ -36,6 +37,9 @@ for my $file ( dir_list("t/cases", qr/^put/ ) ) {
if ( $case->{content} ) {
$options{content} = $case->{content}->[0];
}
elsif ( $case->{content_cb} ) {
$options{content} = eval join "\n", @{$case->{content_cb}};
}
# setup mocking and test
my $res_fh = tmpfile($give_res);
......
url
http://example.com/callback.txt
headers
Content-Type: text/plain
Content-Length: 42
content_cb
my @content = qq{abcdefghijklmnopqrstuvwxyz1234567890abcdef};
sub { shift @content }
----------
PUT /callback.txt HTTP/1.1
Host: example.com
Connection: close
User-Agent: HTTP-Tiny/VERSION
Content-Type: text/plain
Content-Length: 42
abcdefghijklmnopqrstuvwxyz1234567890abcdef
----------
HTTP/1.1 201 Created
Date: Thu, 03 Feb 1994 00:00:00 GMT
Location: http://example.com/callback.txt
Content-Length: 0
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