File tree 1 file changed +62
-3
lines changed
1 file changed +62
-3
lines changed Original file line number Diff line number Diff line change 1
- use Test ::Nginx::Socket;
1
+ use Test ::Nginx::Socket ' no_plan ' ;
2
2
use Cwd qw(cwd);
3
3
4
- plan tests => repeat_each() * (blocks() * 4 );
5
-
6
4
my $ pwd = cwd();
7
5
8
6
$ ENV {TEST_NGINX_RESOLVER} = ' 8.8.8.8' ;
@@ -163,3 +161,64 @@ GET /a
163
161
-- - no_error_log
164
162
[error]
165
163
[warn ]
164
+
165
+
166
+ === TEST 4 : Chunked. multiple-headers, mixed case
167
+ -- - http_config eval: $::HttpConfig
168
+ -- - config
169
+ location = /a {
170
+ content_by_lua_block {
171
+ local http = require " resty.http"
172
+ local httpc = http. new ()
173
+ httpc: connect(" 127.0.0.1" , ngx. var. server_port)
174
+
175
+ local res, err = httpc: request{
176
+ path = " /b"
177
+ }
178
+
179
+ local chunks = {}
180
+ local c = 1
181
+ repeat
182
+ local chunk, err = res. body_reader()
183
+ if chunk then
184
+ chunks[c] = chunk
185
+ c = c + 1
186
+ end
187
+ until not chunk
188
+
189
+ local body = table. concat(chunks)
190
+
191
+ ngx. say (# body)
192
+ ngx. say (# chunks)
193
+ ngx. say (type(res. headers[" Transfer-Encoding" ]))
194
+ httpc: close()
195
+ }
196
+ }
197
+ location = /b {
198
+ header_filter_by_lua_block {
199
+ ngx. header[" Transfer-Encoding" ] = {" chUnked" , " CHunked" }
200
+ }
201
+ content_by_lua_block {
202
+ local len = 32768
203
+ local t = {}
204
+ for i= 1 ,len do
205
+ t[i] = 0
206
+ end
207
+ ngx. print (table. concat(t))
208
+ local len = 32768
209
+ local t = {}
210
+ for i= 1 ,len do
211
+ t[i] = 0
212
+ end
213
+ ngx. print (table. concat(t))
214
+ }
215
+ }
216
+ -- - request
217
+ GET / a
218
+ -- - response_body
219
+ 65536
220
+ 2
221
+ table
222
+ -- - no_error_log
223
+ [error]
224
+ [warn ]
You can’t perform that action at this time.
0 commit comments