comparison rewrite.t @ 337:43d40a678a64

Tests: added rewrite test for response without reason phrase.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 19 Sep 2013 12:22:55 +0400
parents 6a0d934950bc
children 847ea345becb
comparison
equal deleted inserted replaced
336:b6c7db85bad0 337:43d40a678a64
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(21) 24 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(22)
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;
54 return 204; 54 return 204;
55 } 55 }
56 56
57 location /return200 { 57 location /return200 {
58 return 200; 58 return 200;
59 }
60
61 location /return306 {
62 return 306;
59 } 63 }
60 64
61 location /return405 { 65 location /return405 {
62 return 405; 66 return 405;
63 } 67 }
149 like(http_get('/no?a=b'), qr!^Location: http://example.com/\?c=d\x0d?$!ms, 153 like(http_get('/no?a=b'), qr!^Location: http://example.com/\?c=d\x0d?$!ms,
150 'no args with args'); 154 'no args with args');
151 155
152 like(http_get('/return204'), qr!204 No Content!, 'return 204'); 156 like(http_get('/return204'), qr!204 No Content!, 'return 204');
153 like(http_get('/return200'), qr!200 OK!, 'return 200'); 157 like(http_get('/return200'), qr!200 OK!, 'return 200');
158
159 TODO: {
160 local $TODO = 'not yet' unless $t->has_version('1.5.6');
161
162 like(http_get('/return306'), qr!HTTP/1.1 306 !, 'return 306');
163
164 }
165
154 like(http_get('/return405'), qr!HTTP/1.1 405.*body!ms, 'return 405'); 166 like(http_get('/return405'), qr!HTTP/1.1 405.*body!ms, 'return 405');
155 167
156 like(http_get('/error404return405'), qr!HTTP/1.1 404!, 'error 404 return 405'); 168 like(http_get('/error404return405'), qr!HTTP/1.1 404!, 'error 404 return 405');
157 169
158 # status code should be 405, and entity body is expected (vs. normal 204 170 # status code should be 405, and entity body is expected (vs. normal 204