6 eval { require YAML; import YAML 'LoadFile'; };
8 eval { require YAML::Syck; import YAML::Syck 'LoadFile'; }
11 plan skip_all => 'Tests need YAML or YAML::Syck' if $@;
17 use File::Spec::Functions;
20 my $path = catdir( getcwd(), 't', 'data', 'octetstream' );
22 for ( my $i = 1 ; $i <= 2 ; $i++ ) {
24 my $test = sprintf( "%.3d", $i );
25 my $headers = YAML::LoadFile( catfile( $path, "$test-headers.yml" ) );
27 slurp_fh( IO::File->new( catfile( $path, "$test-results.dat" ) ) );
28 my $content = IO::File->new( catfile( $path, "$test-content.dat" ) );
29 my $body = HTTP::Body->new( $headers->{'Content-Type'},
30 $headers->{'Content-Length'} );
32 binmode $content, ':raw';
34 while ( $content->read( my $buffer, 1024 ) ) {
38 isa_ok( $body->body, 'File::Temp', "$test OctetStream body isa" );
39 my $data = slurp_fh( $body->body );
40 is_deeply( $data, $results, "$test UrlEncoded body" );
41 cmp_ok( $body->state, 'eq', 'done', "$test UrlEncoded state" );
44 $headers->{'Content-Length'},
45 "$test UrlEncoded length"
52 while ( $fh->read( my $buffer, 1024 ) ) {