comparison rewrite.t @ 180:58ee6372aba0

Tests: return problems are fixed in 1.1.5, remove TODO.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 01 Nov 2011 21:36:19 +0300
parents c0ae29632905
children 7f5095965c88
comparison
equal deleted inserted replaced
179:2fc8a41e3307 180:58ee6372aba0
143 like(http_get('/return200'), qr!200 OK!, 'return 200'); 143 like(http_get('/return200'), qr!200 OK!, 'return 200');
144 like(http_get('/return405'), qr!HTTP/1.1 405.*body!ms, 'return 405'); 144 like(http_get('/return405'), qr!HTTP/1.1 405.*body!ms, 'return 405');
145 145
146 like(http_get('/error404return405'), qr!HTTP/1.1 404!, 'error 404 return 405'); 146 like(http_get('/error404return405'), qr!HTTP/1.1 404!, 'error 404 return 405');
147 147
148 TODO: {
149 local $TODO = 'not yet';
150
151 # status code should be 405, and entity body is expected (vs. normal 204 148 # status code should be 405, and entity body is expected (vs. normal 204
152 # replies which doesn't expect to have body); use HTTP/1.1 for test 149 # replies which doesn't expect to have body); use HTTP/1.1 for test
153 # to make problem clear 150 # to make problem clear
154 151
155 my $r = http(<<EOF); 152 my $r = http(<<EOF);
167 # in /error405return200text below) 164 # in /error405return200text below)
168 165
169 like(http_get('/error405return200'), qr/HTTP\/1.1 405(?!.*body)/ms, 166 like(http_get('/error405return200'), qr/HTTP\/1.1 405(?!.*body)/ms,
170 'error 405 return 200'); 167 'error 405 return 200');
171 168
172 }
173
174 # tests involving return with two arguments, as introduced in 169 # tests involving return with two arguments, as introduced in
175 # 0.8.42 170 # 0.8.42
176 171
177 like(http_get('/return200text'), qr!text\z!, 'return 200 text'); 172 like(http_get('/return200text'), qr!text\z!, 'return 200 text');
178 like(http_get('/return404text'), qr!text\z!, 'return 404 text'); 173 like(http_get('/return404text'), qr!text\z!, 'return 404 text');
179 174
180 TODO: {
181 local $TODO = 'not yet';
182
183 like(http_get('/error405return200text'), qr!HTTP/1.1 405.*text\z!ms, 175 like(http_get('/error405return200text'), qr!HTTP/1.1 405.*text\z!ms,
184 'error 405 to return 200 text'); 176 'error 405 to return 200 text');
185
186 }
187 177
188 # return 302 is somewhat special: it adds Location header instead of 178 # return 302 is somewhat special: it adds Location header instead of
189 # body text. additionally it doesn't sent reply directly (as it's done for 179 # body text. additionally it doesn't sent reply directly (as it's done for
190 # other returns since 0.8.42) but instead returns NGX_HTTP_* code 180 # other returns since 0.8.42) but instead returns NGX_HTTP_* code
191 181
192 like(http_get('/return302text'), qr!HTTP/1.1 302.*Location: text!ms, 182 like(http_get('/return302text'), qr!HTTP/1.1 302.*Location: text!ms,
193 'return 302 text'); 183 'return 302 text');
194 184
195 TODO: {
196 local $TODO = 'not yet';
197
198 like(http_get('/error302return200text'), 185 like(http_get('/error302return200text'),
199 qr!HTTP/1.1 302.*Location: text.*text\z!ms, 186 qr!HTTP/1.1 302.*Location: text.*text\z!ms,
200 'error 302 return 200 text'); 187 'error 302 return 200 text');
201 188
202 }
203
204 TODO: {
205 local $TODO = 'not yet';
206
207 # in contrast to other return's this shouldn't preserve original status code 189 # in contrast to other return's this shouldn't preserve original status code
208 # from error, and the same applies to "rewrite ... redirect" as an error 190 # from error, and the same applies to "rewrite ... redirect" as an error
209 # handler; both should in line with e.g. directory redirect as well 191 # handler; both should in line with e.g. directory redirect as well
210 192
211 like(http_get('/error405return302text'), 193 like(http_get('/error405return302text'),
214 196
215 like(http_get('/error405rewrite'), 197 like(http_get('/error405rewrite'),
216 qr!HTTP/1.1 302.*Location: http://example.com/!ms, 198 qr!HTTP/1.1 302.*Location: http://example.com/!ms,
217 'error 405 rewrite redirect'); 199 'error 405 rewrite redirect');
218 200
219 }
220
221 like(http_get('/error405directory'), 201 like(http_get('/error405directory'),
222 qr!HTTP/1.1 301.*Location: http://!ms, 202 qr!HTTP/1.1 301.*Location: http://!ms,
223 'error 405 directory redirect'); 203 'error 405 directory redirect');
224 204
225 ############################################################################### 205 ###############################################################################