X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F05urlencoded.t;h=ef9226257d794383865efa28118fe86f58a4abc2;hb=0a66fd2366e29e961fe3ee608a83f86068517c92;hp=b73c51acca53b12c54b71182f89e94a2525309e5;hpb=807be76d0cc3edc476c5242d8895044611081f48;p=catagits%2FHTTP-Body.git diff --git a/t/05urlencoded.t b/t/05urlencoded.t index b73c51a..ef92262 100644 --- a/t/05urlencoded.t +++ b/t/05urlencoded.t @@ -3,9 +3,10 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 16; use Cwd; +use Digest::MD5 qw(md5_hex); use HTTP::Body; use File::Spec::Functions; use IO::File; @@ -13,7 +14,7 @@ use YAML; my $path = catdir( getcwd(), 't', 'data', 'urlencoded' ); -for ( my $i = 1; $i <= 2; $i++ ) { +for ( my $i = 1; $i <= 3; $i++ ) { my $test = sprintf( "%.3d", $i ); my $headers = YAML::LoadFile( catfile( $path, "$test-headers.yml" ) ); @@ -31,5 +32,12 @@ for ( my $i = 1; $i <= 2; $i++ ) { is_deeply( $body->param, $results->{param}, "$test UrlEncoded param" ); is_deeply( $body->upload, $results->{upload}, "$test UrlEncoded upload" ); cmp_ok( $body->state, 'eq', 'done', "$test UrlEncoded state" ); - cmp_ok( $body->length, '==', $headers->{'Content-Length'}, "$test UrlEncoded length" ); + cmp_ok( $body->length, '==', $body->content_length, "$test UrlEncoded length" ); + + # Check trailing header on the chunked request + if ( $i == 3 ) { + my $content = IO::File->new( catfile( $path, "002-content.dat" ) ); + $content->read( my $buf, 4096 ); + is( $body->trailing_headers->header('Content-MD5'), md5_hex($buf), "$test trailing header ok" ); + } }