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
index 9cbc515..921a88a 100644
--- a/body.t
+++ b/body.t
@@ -22,7 +22,7 @@
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 @@
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(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
index eef7aa1..181fca6 100644
--- a/body_chunked.t
+++ b/body_chunked.t
@@ -22,7 +22,7 @@
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 @@
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(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,