changeset 578:8504a62496df

Tests: sub_filter last_modified tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 18 May 2015 13:28:54 +0300
parents 90f9b128b218
children 6d1b945c9c60
files sub_filter.t
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sub_filter.t
+++ b/sub_filter.t
@@ -21,7 +21,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http rewrite sub/)->plan(25)
+my $t = Test::Nginx->new()->has(qw/http rewrite sub/)->plan(28)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -88,6 +88,16 @@ http {
             sub_filter aab '${arg_a}_replaced';
             return 200 $arg_b;
         }
+
+        location /lm {
+            sub_filter_last_modified on;
+            proxy_pass http://127.0.0.1:8081/;
+        }
+    }
+
+    server {
+        listen       127.0.0.1:8081;
+        server_name  localhost;
     }
 }
 
@@ -138,4 +148,8 @@ like(http_get('/var/string?a=abcdefghijk
 like(http_get('/var/replacement?a=ee&b=aaab'), qr/aee_replaced/,
 	'complex replacement');
 
+unlike(http_get('/foo.html'), qr/(Last-Modified|ETag)/, 'no last modified');
+like(http_get('/lm/foo.html'), qr/Last-Modified/, 'last modified');
+like(http_get('/lm/foo.html'), qr!ETag: W/"[^"]+"!, 'last modified weak');
+
 ###############################################################################