comparison rewrite.t @ 1546:0902a4539c99

Tests: added rewrite "break" directive test for valid location.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 17 Jan 2020 22:36:34 +0300
parents 144c6ce732e4
children 5ac6efbe5552
comparison
equal deleted inserted replaced
1545:cde406e61e48 1546:0902a4539c99
19 ############################################################################### 19 ###############################################################################
20 20
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(22) 24 my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(23)
25 ->write_file_expand('nginx.conf', <<'EOF'); 25 ->write_file_expand('nginx.conf', <<'EOF');
26 26
27 %%TEST_GLOBALS%% 27 %%TEST_GLOBALS%%
28 28
29 daemon off; 29 daemon off;
127 } 127 }
128 128
129 location /capturedup { 129 location /capturedup {
130 rewrite ^(.*) $1?c=$1; 130 rewrite ^(.*) $1?c=$1;
131 return 200 "uri:$uri args:$args"; 131 return 200 "uri:$uri args:$args";
132 }
133
134 location /break {
135 rewrite ^ /return200;
136 break;
137 proxy_pass http://127.0.0.1:8080/return204;
132 } 138 }
133 } 139 }
134 } 140 }
135 141
136 EOF 142 EOF
229 235
230 like(http_get('/capturedup/%25?a=b'), 236 like(http_get('/capturedup/%25?a=b'),
231 qr!^uri:/capturedup/% args:c=/capturedup/%25&a=b$!ms, 237 qr!^uri:/capturedup/% args:c=/capturedup/%25&a=b$!ms,
232 'escape with added args'); 238 'escape with added args');
233 239
234 ############################################################################### 240 # break
241
242 TODO: {
243 local $TODO = 'not yet' unless $t->has_version('1.17.8');
244
245 like(http_get('/break'), qr/200/, 'valid_location reset');
246
247 }
248
249 ###############################################################################