Tests: discarded request body in error_page redirect.
diff --git a/body.t b/body.t
index 921a88a..0e3561d 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(14);
+my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(15);
$t->write_file_expand('nginx.conf', <<'EOF');
@@ -81,6 +81,9 @@
location /next {
proxy_pass http://u/;
}
+ location /redirect {
+ error_page 404 http://example.com/;
+ }
}
server {
@@ -165,6 +168,24 @@
like(http_get_body('/next', '0123456789'),
qr/X-Body: 0123456789\x0d?$/ms, 'body next upstream');
+# discarded request body in redirect via error_page
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.17.7');
+
+unlike(
+ http(
+ 'POST /redirect HTTP/1.1' . CRLF
+ . 'Host: localhost' . CRLF
+ . 'Content-Length: 10' . CRLF . CRLF
+ . '0123456789' .
+ 'GET /next HTTP/1.0' . CRLF . CRLF
+ ),
+ qr/400 Bad Request/ms, 'redirect - discard request body'
+);
+
+}
+
###############################################################################
sub read_body_file {