Mercurial > hg > nginx-tests
changeset 1698:90201294e1b6
Tests: added grpc request body test with a special last buffer.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 03 Jun 2021 14:38:58 +0300 |
parents | 5386f4328b90 |
children | 202d8feedad1 |
files | grpc.t |
diffstat | 1 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/grpc.t Wed Jun 02 15:51:29 2021 +0300 +++ b/grpc.t Thu Jun 03 14:38:58 2021 +0300 @@ -24,7 +24,7 @@ select STDOUT; $| = 1; my $t = Test::Nginx->new()->has(qw/http rewrite http_v2 grpc/) - ->has(qw/upstream_keepalive/)->plan(123); + ->has(qw/upstream_keepalive/)->plan(130); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -154,6 +154,23 @@ ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; cmp_ok($frame->{headers}{'x-connection'}, '>', $c, 'response 2 - connection'); +# request body - special last buffer + +$f->{http_start}('/SayHello'); +$frames = $f->{data}('Hello', body_more => 1); +($frame) = grep { $_->{type} eq "DATA" } @$frames; +is($frame->{data}, 'Hello', 'request body first - DATA'); +is($frame->{length}, 5, 'request body first - DATA length'); +is($frame->{flags}, 0, 'request body first - DATA flags'); +$frames = $f->{data}(''); +($frame) = grep { $_->{type} eq "DATA" } @$frames; +is($frame->{data}, '', 'special buffer last - DATA'); +is($frame->{length}, 0, 'special buffer last - DATA length'); +is($frame->{flags}, 1, 'special buffer last - DATA flags'); +$frames = $f->{http_end}(); +($frame) = grep { $_->{type} eq "HEADERS" } @$frames; +is($frame->{headers}{':status'}, '200', 'special buffer last - response'); + # upstream keepalive $frames = $f->{http_start}('/KeepAlive');