Skip to content

Commit b03a231

Browse files
committed
Tests: added error_page tests with args in internal redirect.
1 parent 46c7ad4 commit b03a231

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

http_error_page.t

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use Test::Nginx;
2121
select STDERR; $| = 1;
2222
select STDOUT; $| = 1;
2323

24-
my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(7)
24+
my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(9)
2525
->write_file_expand('nginx.conf', <<'EOF');
2626
2727
%%TEST_GLOBALS%%
@@ -63,6 +63,20 @@ http {
6363
return 302 "http://example.com/";
6464
}
6565
66+
location /error302return302args {
67+
error_page 302 /return302args?1;
68+
return 302 "first";
69+
}
70+
71+
location /error302return302varargs {
72+
error_page 302 /return302args?$arg_a;
73+
return 302 "first";
74+
}
75+
76+
location /return302args {
77+
return 302 "http://example.com/$args";
78+
}
79+
6680
location /error302rewrite {
6781
error_page 302 /rewrite;
6882
return 302 "first";
@@ -116,6 +130,14 @@ like(http_get('/error302return302text'),
116130
qr{HTTP/1.1 302(?!.*Location: first).*Location: http://example.com/}ms,
117131
'error 302 return 302 text - old location cleared');
118132

133+
like(http_get('/error302return302args'),
134+
qr{HTTP/1.1 302(?!.*Location: first).*Location: http://example.com/1}ms,
135+
'error 302 return 302 args - old location cleared');
136+
137+
like(http_get('/error302return302varargs?a=2'),
138+
qr{HTTP/1.1 302(?!.*Location: first).*Location: http://example.com/2}ms,
139+
'error 302 return 302 var args - old location cleared');
140+
119141
like(http_get('/error302rewrite'),
120142
qr{HTTP/1.1 302(?!.*Location: first).*Location: http://example.com/}ms,
121143
'error 302 rewrite - old location cleared');

0 commit comments

Comments
 (0)