1# vi:filetype=
2
3use lib 'lib';
4use Test::Nginx::Socket;
5
6repeat_each(2);
7
8plan tests => repeat_each() * (5 * blocks());
9
10no_long_string();
11log_level('warn');
12
13#master_on();
14#workers(1);
15
16run_tests();
17
18__DATA__
19
20=== TEST 1: filters used
21--- http_config
22    postpone_output 1;
23--- config
24    location /echo {
25        echo world;
26        echo_after_body hello;
27    }
28--- request
29    GET /echo?blah
30--- response_body
31world
32hello
33--- error_log
34echo header filter, uri "/echo?blah"
35echo body filter, uri "/echo?blah"
36--- no_error_log
37[error]
38--- log_level: debug
39
40
41
42=== TEST 2: filters not used
43--- http_config
44    postpone_output 1;
45--- config
46    location /echo {
47        echo world;
48        #echo_after_body hello;
49    }
50--- request
51    GET /echo?blah
52--- response_body
53world
54--- no_error_log
55echo header filter, uri "/echo?blah"
56echo body filter, uri "/echo?blah"
57[error]
58--- log_level: debug
59
60
61
62=== TEST 3: (after) filters used (multiple http {} blocks)
63This test case won't run with nginx 1.9.3+ since duplicate http {} blocks
64have been prohibited since then.
65--- SKIP
66--- http_config
67    postpone_output 1;
68--- config
69    location /echo {
70        echo world;
71        echo_after_body hello;
72    }
73
74--- post_main_config
75    http {
76    }
77
78--- request
79    GET /echo?blah
80--- response_body
81world
82hello
83--- error_log
84echo header filter, uri "/echo?blah"
85echo body filter, uri "/echo?blah"
86--- no_error_log
87[error]
88--- log_level: debug
89
90
91
92=== TEST 4: (before) filters used (multiple http {} blocks)
93This test case won't run with nginx 1.9.3+ since duplicate http {} blocks
94have been prohibited since then.
95--- SKIP
96--- http_config
97    postpone_output 1;
98--- config
99    location /echo {
100        echo world;
101        echo_before_body hello;
102    }
103
104--- post_main_config
105    http {
106    }
107
108--- request
109    GET /echo?blah
110--- response_body
111hello
112world
113--- error_log
114echo header filter, uri "/echo?blah"
115echo body filter, uri "/echo?blah"
116--- no_error_log
117[error]
118--- log_level: debug
119
120