From 853b95b552808b5e6c2e18c43532dfa310139707 Mon Sep 17 00:00:00 2001 From: Brent Yarger Date: Thu, 30 Nov 2023 11:02:13 -0800 Subject: [PATCH] Add ngx globals to 01-header_transformer_spec setup --- .../01-header_transformer_spec.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/03-plugins/15-response-transformer/01-header_transformer_spec.lua b/spec/03-plugins/15-response-transformer/01-header_transformer_spec.lua index 4ec31a7832bd..d5e173907554 100644 --- a/spec/03-plugins/15-response-transformer/01-header_transformer_spec.lua +++ b/spec/03-plugins/15-response-transformer/01-header_transformer_spec.lua @@ -20,6 +20,7 @@ describe("Plugin: response-transformer", function() local header_transformer setup(function() + print("1") _G.ngx = { headers_sent = false, resp = { @@ -31,10 +32,20 @@ describe("Plugin: response-transformer", function() KONG_PHASE = 0x00000200, }, } + print("2") + + _G.ngx.DEBUG = 8 + _G.ngx.INFO = 7 + _G.ngx.NOTICE = 6 + _G.ngx.WARN = 5 + _G.ngx.ERR = 4 + _G.ngx.CRIT = 3 + _G.ngx.ALERT = 2 + _G.ngx.EMERG = 1 + _G.kong = { response = require "kong.pdk.response".new(), } - -- mock since FFI based ngx.resp.add_header won't work in this setup _G.kong.response.add_header = function(name, value) local new_value = _G.kong.response.get_headers()[name]