# HG changeset patch # User Sergey Kandaurov # Date 1566471734 -10800 # Node ID 44ce08f5259f034c102b7f99b37c423de848c75a # Parent c9d7e2a26b2d418106383908b90bb1154e5372f3 Tests: client_max_body_size tests in body.t, body_chunked.t. HTTP/2 client_max_body_size tests were committed in 762:f28debc81182. diff --git a/body.t b/body.t --- a/body.t +++ b/body.t @@ -22,7 +22,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(13); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(14); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -71,6 +71,10 @@ http { add_header X-Body-File "$request_body_file"; proxy_pass http://127.0.0.1:8081; } + location /large { + client_max_body_size 1k; + proxy_pass http://127.0.0.1:8081; + } location /discard { return 200 "TEST\n"; } @@ -121,6 +125,8 @@ like(read_body_file(http_get_body('/b', like(http_get_body('/single', '0123456789' x 128), qr/X-Body: (0123456789){128}\x0d?$/ms, 'body in single buffer'); +like(http_get_body('/large', '0123456789' x 128), qr/ 413 /, 'body too large'); + # pipelined requests like(http_get_body('/', '0123456789', '0123456789' x 128, '0123456789' x 512, diff --git a/body_chunked.t b/body_chunked.t --- a/body_chunked.t +++ b/body_chunked.t @@ -22,7 +22,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(10); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(11); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -66,6 +66,10 @@ http { add_header X-Body-File "$request_body_file"; proxy_pass http://127.0.0.1:8081; } + location /large { + client_max_body_size 1k; + proxy_pass http://127.0.0.1:8081; + } location /discard { return 200 "TEST\n"; } @@ -114,6 +118,8 @@ like(read_body_file(http_get_body('/b', like(http_get_body('/single', '0123456789' x 128), qr/X-Body: (0123456789){128}\x0d?$/ms, 'body in single buffer'); +like(http_get_body('/large', '0123456789' x 128), qr/ 413 /, 'body too large'); + # pipelined requests like(http_get_body('/', '0123456789', '0123456789' x 128, '0123456789' x 512,