changeset 228:5c9e43547b71

Tests: proxy_hide_header/proxy_pass_header inheritance tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 24 Jul 2012 20:06:54 +0400
parents 16371849bd07
children 9969fcf1f27e
files proxy_merge_headers.t
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/proxy_merge_headers.t
+++ b/proxy_merge_headers.t
@@ -23,7 +23,7 @@ select STDOUT; $| = 1;
 
 plan(skip_all => 'win32') if $^O eq 'MSWin32';
 
-my $t = Test::Nginx->new()->has(qw/http proxy cache rewrite/)->plan(3)
+my $t = Test::Nginx->new()->has(qw/http proxy cache rewrite/)->plan(7)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -40,6 +40,7 @@ http {
                        keys_zone=NAME:10m;
 
     proxy_set_header X-Blah "blah";
+    proxy_hide_header X-Hidden;
 
     server {
         listen       127.0.0.1:8080;
@@ -49,6 +50,11 @@ http {
 
         location / {
             proxy_pass    http://127.0.0.1:8081;
+
+            location /nested/ {
+                proxy_pass   http://127.0.0.1:8081;
+                proxy_pass_header X-Pad;
+            }
         }
 
         location /no/ {
@@ -67,6 +73,8 @@ http {
         server_name  localhost;
 
         location / {
+            add_header X-Hidden "hidden";
+            add_header X-Pad "passed";
             return 200 "ims=$http_if_modified_since;blah=$http_x_blah;";
         }
     }
@@ -87,6 +95,16 @@ like(http_get_ims('/no/'), qr/ims=blah;b
 like(http_get_ims('/setbody/'), qr/blah=blah;/,
 	'proxy_set_header inherited with proxy_set_body');
 
+unlike(http_get('/'), qr/X-Pad/, 'proxy_pass_header default');
+like(http_get('/nested/'), qr/X-Pad/, 'proxy_pass_header nested');
+unlike(http_get('/'), qr/X-Hidden/, 'proxy_hide_header inherited');
+
+TODO: {
+local $TODO = 'not yet';
+
+unlike(http_get('/nested/'), qr/X-Hidden/, 'proxy_hide_header nested');
+}
+
 ###############################################################################
 
 sub http_get_ims {