8 eval { require YAML; import YAML 'LoadFile'; };
10 eval { require YAML::Syck; import YAML::Syck 'LoadFile'; }
13 plan skip_all => 'Tests need YAML or YAML::Syck' if $@;
19 use File::Spec::Functions;
22 my $path = catdir( getcwd(), 't', 'data', 'urlencoded' );
24 for ( my $i = 1; $i <= 1; $i++ ) {
26 my $test = sprintf( "%.3d", $i );
27 my $headers = YAML::LoadFile( catfile( $path, "$test-headers.yml" ) );
28 my $results = YAML::LoadFile( catfile( $path, "$test-results.yml" ) );
29 my $content = IO::File->new( catfile( $path, "$test-content.dat" ) );
30 my $body = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} );
32 binmode $content, ':raw';
34 while ( $content->read( my $buffer, 1024 ) ) {
38 is_deeply( $body->body, $results->{body}, "$test UrlEncoded body" );
39 is_deeply( $body->param, $results->{param}, "$test UrlEncoded param" );
40 is_deeply( $body->upload, $results->{upload}, "$test UrlEncoded upload" );
41 cmp_ok( $body->state, 'eq', 'done', "$test UrlEncoded state" );
42 cmp_ok( $body->length, '==', $headers->{'Content-Length'}, "$test UrlEncoded length" );