comparison sub_filter.t @ 578:8504a62496df

Tests: sub_filter last_modified tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 18 May 2015 13:28:54 +0300
parents eea2b0158b51
children 6d1b945c9c60
comparison
equal deleted inserted replaced
577:90f9b128b218 578:8504a62496df
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 sub/)->plan(25) 24 my $t = Test::Nginx->new()->has(qw/http rewrite sub/)->plan(28)
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;
86 86
87 location /var/replacement { 87 location /var/replacement {
88 sub_filter aab '${arg_a}_replaced'; 88 sub_filter aab '${arg_a}_replaced';
89 return 200 $arg_b; 89 return 200 $arg_b;
90 } 90 }
91
92 location /lm {
93 sub_filter_last_modified on;
94 proxy_pass http://127.0.0.1:8081/;
95 }
96 }
97
98 server {
99 listen 127.0.0.1:8081;
100 server_name localhost;
91 } 101 }
92 } 102 }
93 103
94 EOF 104 EOF
95 105
136 } 146 }
137 147
138 like(http_get('/var/replacement?a=ee&b=aaab'), qr/aee_replaced/, 148 like(http_get('/var/replacement?a=ee&b=aaab'), qr/aee_replaced/,
139 'complex replacement'); 149 'complex replacement');
140 150
151 unlike(http_get('/foo.html'), qr/(Last-Modified|ETag)/, 'no last modified');
152 like(http_get('/lm/foo.html'), qr/Last-Modified/, 'last modified');
153 like(http_get('/lm/foo.html'), qr!ETag: W/"[^"]+"!, 'last modified weak');
154
141 ############################################################################### 155 ###############################################################################