comparison rewrite.t @ 142:d732aaa5f370

Tests: two more return/error_page tests, with builtin error pages.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 02 Nov 2010 08:20:58 +0300
parents 1e1975cd25ef
children c0ae29632905
comparison
equal deleted inserted replaced
141:1e1975cd25ef 142:d732aaa5f370
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(17) 24 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(19)
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 master_process off; 29 master_process off;
57 57
58 location /return200 { 58 location /return200 {
59 return 200; 59 return 200;
60 } 60 }
61 61
62 location /return405 {
63 return 405;
64 }
65
66 location /error404return405 {
67 error_page 404 /return405;
68 return 404;
69 }
70
62 location /error405return204 { 71 location /error405return204 {
63 error_page 405 /return204; 72 error_page 405 /return204;
64 return 405; 73 return 405;
65 } 74 }
66 75
67 location /error405return200 { 76 location /error405return200 {
68 error_page 405 /return200; 77 error_page 405 /return200;
69 return 405; 78 return 405;
70 }
71
72 location /file.html {
73 } 79 }
74 80
75 location /return200text { 81 location /return200text {
76 return 200 "text"; 82 return 200 "text";
77 } 83 }
134 like(http_get('/no?a=b'), qr!^Location: http://example.com/\?c=d\x0d?$!ms, 140 like(http_get('/no?a=b'), qr!^Location: http://example.com/\?c=d\x0d?$!ms,
135 'no args with args'); 141 'no args with args');
136 142
137 like(http_get('/return204'), qr!204 No Content!, 'return 204'); 143 like(http_get('/return204'), qr!204 No Content!, 'return 204');
138 like(http_get('/return200'), qr!200 OK!, 'return 200'); 144 like(http_get('/return200'), qr!200 OK!, 'return 200');
145 like(http_get('/return405'), qr!HTTP/1.1 405.*body!ms, 'return 405');
146
147 like(http_get('/error404return405'), qr!HTTP/1.1 404!, 'error 404 return 405');
139 148
140 TODO: { 149 TODO: {
141 local $TODO = 'not yet'; 150 local $TODO = 'not yet';
142 151
143 # status code should be 405, and entity body is expected (vs. normal 204 152 # status code should be 405, and entity body is expected (vs. normal 204