changeset 1500:44ce08f5259f

Tests: client_max_body_size tests in body.t, body_chunked.t. HTTP/2 client_max_body_size tests were committed in 762:f28debc81182.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 22 Aug 2019 14:02:14 +0300
parents c9d7e2a26b2d
children 91235919d80f
files body.t body_chunked.t
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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,
--- 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,