# HG changeset patch # User Sergey Kandaurov # Date 1512657153 -10800 # Node ID 784151520a9a25a643d472215c98094bec23d99d # Parent 05b2033f5377ff5729926e2cfaf11bfdb8b9451b Tests: added error_page tests with args in internal redirect. diff --git a/http_error_page.t b/http_error_page.t --- a/http_error_page.t +++ b/http_error_page.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(7) +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(9) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -63,6 +63,20 @@ http { return 302 "http://example.com/"; } + location /error302return302args { + error_page 302 /return302args?1; + return 302 "first"; + } + + location /error302return302varargs { + error_page 302 /return302args?$arg_a; + return 302 "first"; + } + + location /return302args { + return 302 "http://example.com/$args"; + } + location /error302rewrite { error_page 302 /rewrite; return 302 "first"; @@ -116,6 +130,14 @@ like(http_get('/error302return302text'), qr{HTTP/1.1 302(?!.*Location: first).*Location: http://example.com/}ms, 'error 302 return 302 text - old location cleared'); +like(http_get('/error302return302args'), + qr{HTTP/1.1 302(?!.*Location: first).*Location: http://example.com/1}ms, + 'error 302 return 302 args - old location cleared'); + +like(http_get('/error302return302varargs?a=2'), + qr{HTTP/1.1 302(?!.*Location: first).*Location: http://example.com/2}ms, + 'error 302 return 302 var args - old location cleared'); + like(http_get('/error302rewrite'), qr{HTTP/1.1 302(?!.*Location: first).*Location: http://example.com/}ms, 'error 302 rewrite - old location cleared');