Skip to content

Commit

Permalink
pass lower_func
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Dec 19, 2023
1 parent 11d37e7 commit 627f7af
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kong/router/fields.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ local COMPLEX_FIELDS_FUNCS = {
for _, name in ipairs(v) do
local value = headers[name]

local res, err = cb("http.headers." .. name, value)
local res, err = cb("http.headers." .. name, value,
replace_dashes_lower) -- only for cache_key
if not res then
return nil, err
end
Expand Down Expand Up @@ -123,6 +124,7 @@ local str_buf = buffer.new(64)
local function get_cache_key(fields, params)
str_buf:reset()

-- NOTE: DO NOT yield until str_buf:get()
for field, value in pairs(fields) do

-- these fields were not in cache key
Expand All @@ -146,11 +148,9 @@ local function get_cache_key(fields, params)
func = COMPLEX_FIELDS_FUNCS[field]

if func then -- http.headers.* or http.queries.*
func(value, params, function(field, value)
local headers_or_queries = field:sub(1, PREFIX_LEN)

if headers_or_queries == "http.headers." then
field = replace_dashes_lower(field)
func(value, params, function(field, value, lower_func)
if lower_func then
field = lower_func(field)
end

if type(value) == "table" then
Expand Down

0 comments on commit 627f7af

Please sign in to comment.