Tests: added ngx_http_upstream_test_next() cases.
diff --git a/proxy_non_idempotent.t b/proxy_non_idempotent.t
index d0f453f..ba993ca 100644
--- a/proxy_non_idempotent.t
+++ b/proxy_non_idempotent.t
@@ -23,7 +23,7 @@
select STDOUT; $| = 1;
my $t = Test::Nginx->new()->has(qw/http proxy rewrite upstream_keepalive/)
- ->plan(6);
+ ->plan(8);
$t->write_file_expand('nginx.conf', <<'EOF');
@@ -56,7 +56,7 @@
location / {
proxy_pass http://u;
- proxy_next_upstream error timeout;
+ proxy_next_upstream error timeout http_404;
}
location /non {
@@ -80,6 +80,10 @@
return 444;
}
+ location /404 {
+ return 404 SEE-THIS;
+ }
+
location /keepalive/establish {
return 204;
}
@@ -98,6 +102,18 @@
like(http_get('/'), qr/X-IP: (\S+), \1\x0d?$/m, 'get');
like(http_post('/'), qr/X-IP: (\S+)\x0d?$/m, 'post');
+# non-idempotent requests should not be retried by default,
+# in particular, not emit builtin error page due to next upstream
+
+like(http_get('/404'), qr/X-IP: (\S+), \1.*SEE-THIS/s, 'get 404');
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.13.11');
+
+like(http_post('/404'), qr/X-IP: (\S++)(?! ).*SEE-THIS/s, 'post 404');
+
+}
+
# with "proxy_next_upstream non_idempotent" there is no
# difference between idempotent and non-idempotent requests,
# non-idempotent requests are retried as usual