Mercurial > hg > nginx-tests
changeset 884:d1b94c1127d6
Tests: added HTTP/2 tests for request body with cached response.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 25 Mar 2016 04:40:27 +0300 |
parents | 8c3fa5a94743 |
children | a1e76cca714c |
files | h2_cache.t |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/h2_cache.t Thu Mar 24 17:45:35 2016 +0300 +++ b/h2_cache.t Fri Mar 25 04:40:27 2016 +0300 @@ -16,14 +16,14 @@ 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 @@ ($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();