Mercurial > hg > nginx-tests
comparison http_try_files.t @ 214:35d050d7d5f1
Tests: add try_files test with short uri (ticket #152).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 24 Apr 2012 14:21:59 +0400 |
parents | 802fc0786165 |
children | ba992cfdc606 |
comparison
equal
deleted
inserted
replaced
213:4ac0807cc3cf | 214:35d050d7d5f1 |
---|---|
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(3) | 24 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(4) |
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; |
42 try_files $uri /fallback; | 42 try_files $uri /fallback; |
43 } | 43 } |
44 | 44 |
45 location /nouri/ { | 45 location /nouri/ { |
46 try_files $uri /fallback_nouri; | 46 try_files $uri /fallback_nouri; |
47 } | |
48 | |
49 location /short/ { | |
50 try_files /short $uri =404; | |
47 } | 51 } |
48 | 52 |
49 location /fallback { | 53 location /fallback { |
50 proxy_pass http://127.0.0.1:8081/fallback; | 54 proxy_pass http://127.0.0.1:8081/fallback; |
51 } | 55 } |
72 | 76 |
73 ############################################################################### | 77 ############################################################################### |
74 | 78 |
75 like(http_get('/found.html'), qr!SEE THIS!, 'found'); | 79 like(http_get('/found.html'), qr!SEE THIS!, 'found'); |
76 like(http_get('/uri/notfound'), qr!X-URI: /fallback!, 'not found uri'); | 80 like(http_get('/uri/notfound'), qr!X-URI: /fallback!, 'not found uri'); |
81 like(http_get('/short/long'), qr!404 Not!, 'short uri in try_files'); | |
77 | 82 |
78 TODO: { | 83 TODO: { |
79 local $TODO = 'fixed in 1.1.12'; | 84 local $TODO = 'fixed in 1.1.12'; |
80 | 85 |
81 like(http_get('/nouri/notfound'), qr!X-URI: /fallback!, 'not found nouri'); | 86 like(http_get('/nouri/notfound'), qr!X-URI: /fallback!, 'not found nouri'); |