Skip to content

Commit

Permalink
Add ngx globals to 01-header_transformer_spec setup
Browse files Browse the repository at this point in the history
  • Loading branch information
brentos committed Nov 30, 2023
1 parent ab8691a commit 853b95b
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe("Plugin: response-transformer", function()
local header_transformer

setup(function()
print("1")
_G.ngx = {
headers_sent = false,
resp = {
Expand All @@ -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]
Expand Down

0 comments on commit 853b95b

Please sign in to comment.