File tree Expand file tree Collapse file tree 1 file changed +67
-1
lines changed Expand file tree Collapse file tree 1 file changed +67
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ log_level('warn');
99
1010repeat_each(2 );
1111
12- plan tests => repeat_each() * (blocks() * 2 + 14 );
12+ plan tests => repeat_each() * (blocks() * 2 + 16 );
1313
1414# no_diff();
1515no_long_string();
@@ -609,3 +609,69 @@ Original bad result: .b.d
609609--- response_body
610610.b.cd
611611
612+
613+
614+ === TEST 27: use of ngx.req.get_headers in the user callback
615+ --- config
616+
617+ location = /t {
618+ content_by_lua '
619+ local data = [[
620+ INNER
621+ INNER
622+ ]]
623+
624+ -- ngx.say(data)
625+
626+ local res = ngx.re.gsub(data, "INNER", function(inner_matches)
627+ local header = ngx.req.get_headers()["Host"]
628+ -- local header = ngx.var["http_HEADER"]
629+ return "INNER_REPLACED"
630+ end, "s")
631+
632+ ngx.print(res)
633+ ' ;
634+ }
635+
636+ --- request
637+ GET /t
638+ --- response_body
639+ INNER_REPLACED
640+ INNER_REPLACED
641+
642+ --- no_error_log
643+ [error]
644+
645+
646+
647+ === TEST 28: use of ngx.var in the user callback
648+ --- config
649+
650+ location = /t {
651+ content_by_lua '
652+ local data = [[
653+ INNER
654+ INNER
655+ ]]
656+
657+ -- ngx.say(data)
658+
659+ local res = ngx.re.gsub(data, "INNER", function(inner_matches)
660+ -- local header = ngx.req.get_headers()["Host"]
661+ local header = ngx.var["http_HEADER"]
662+ return "INNER_REPLACED"
663+ end, "s")
664+
665+ ngx.print(res)
666+ ' ;
667+ }
668+
669+ --- request
670+ GET /t
671+ --- response_body
672+ INNER_REPLACED
673+ INNER_REPLACED
674+
675+ --- no_error_log
676+ [error]
677+
You can’t perform that action at this time.
0 commit comments