# HG changeset patch # User Sergey Kandaurov # Date 1458870027 -10800 # Node ID d1b94c1127d60000e4eaa3bd79690275fe837004 # Parent 8c3fa5a94743f498c0df5333f935d672677d3fff Tests: added HTTP/2 tests for request body with cached response. diff --git a/h2_cache.t b/h2_cache.t --- a/h2_cache.t +++ b/h2_cache.t @@ -16,14 +16,14 @@ BEGIN { use FindBin; chdir($FindBin::Bin use lib 'lib'; use Test::Nginx; -use Test::Nginx::HTTP2; +use Test::Nginx::HTTP2 qw/ :DEFAULT :frame /; ############################################################################### select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http http_v2 cache/)->plan(9) +my $t = Test::Nginx->new()->has(qw/http http_v2 cache/)->plan(11) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -92,6 +92,21 @@ is($frame->{data}, 'SEE-THIS', 'proxy ca ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; is($frame->{headers}->{':status'}, 304, 'proxy cache conditional'); +# request body with cached response + +$sid = new_stream($sess, { path => '/cache/t.html', body_more => 1 }); +h2_body($sess, 'TEST'); +$frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); + +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +is($frame->{headers}->{':status'}, 200, 'proxy cache - request body'); + +h2_ping($sess, 'SEE-THIS'); +$frames = h2_read($sess, all => [{ type => 'PING' }]); + +($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames; +ok($frame, 'proxy cache - request body - next'); + # HEADERS could be received with fin, followed by DATA $sess = new_session();