# HG changeset patch # User Sergey Kandaurov # Date 1522759929 -10800 # Node ID d51cc25260665ec30447f640fcd4d5489ea0fad0 # Parent 890516ca898a3cca79afd7fde6636446ac1e6819 Tests: added ngx_http_upstream_test_next() cases. diff --git a/proxy_non_idempotent.t b/proxy_non_idempotent.t --- a/proxy_non_idempotent.t +++ b/proxy_non_idempotent.t @@ -23,7 +23,7 @@ select STDERR; $| = 1; 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 @@ http { location / { proxy_pass http://u; - proxy_next_upstream error timeout; + proxy_next_upstream error timeout http_404; } location /non { @@ -80,6 +80,10 @@ http { return 444; } + location /404 { + return 404 SEE-THIS; + } + location /keepalive/establish { return 204; } @@ -98,6 +102,18 @@ EOF 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