File tree Expand file tree Collapse file tree 1 file changed +73
-1
lines changed Expand file tree Collapse file tree 1 file changed +73
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use Cwd qw(cwd);
9
9
10
10
repeat_each(2 );
11
11
12
- plan tests => repeat_each() * (blocks() * 4 + 6 );
12
+ plan tests => repeat_each() * (blocks() * 4 + 8 );
13
13
14
14
my $ pwd = cwd();
15
15
@@ -205,3 +205,75 @@ GET /re
205
205
[error]
206
206
bad argument type
207
207
208
+
209
+
210
+ === TEST 6: ngx.re.gsub: use of ngx.req.get_headers in the user callback
211
+ --- http_config eval: $::HttpConfig
212
+ --- config
213
+
214
+ location = /t {
215
+ content_by_lua '
216
+ local data = [[
217
+ INNER
218
+ INNER
219
+ ]]
220
+
221
+ -- ngx.say(data)
222
+
223
+ local res = ngx.re.gsub(data, "INNER", function(inner_matches)
224
+ local header = ngx.req.get_headers()["Host"]
225
+ -- local header = ngx.var["http_HEADER"]
226
+ return "INNER_REPLACED"
227
+ end, "s")
228
+
229
+ ngx.print(res)
230
+ ';
231
+ }
232
+
233
+ --- request
234
+ GET /t
235
+ --- response_body
236
+ INNER_REPLACED
237
+ INNER_REPLACED
238
+
239
+ --- no_error_log
240
+ [error]
241
+ bad argument type
242
+ NYI
243
+
244
+
245
+
246
+ === TEST 7: ngx.re.gsub: use of ngx.var in the user callback
247
+ --- http_config eval: $::HttpConfig
248
+ --- config
249
+
250
+ location = /t {
251
+ content_by_lua '
252
+ local data = [[
253
+ INNER
254
+ INNER
255
+ ]]
256
+
257
+ -- ngx.say(data)
258
+
259
+ local res = ngx.re.gsub(data, "INNER", function(inner_matches)
260
+ -- local header = ngx.req.get_headers()["Host"]
261
+ local header = ngx.var["http_HEADER"]
262
+ return "INNER_REPLACED"
263
+ end, "s")
264
+
265
+ ngx.print(res)
266
+ ';
267
+ }
268
+
269
+ --- request
270
+ GET /t
271
+ --- response_body
272
+ INNER_REPLACED
273
+ INNER_REPLACED
274
+
275
+ --- no_error_log
276
+ [error]
277
+ bad argument type
278
+ NYI
279
+
You can’t perform that action at this time.
0 commit comments