Skip to content

Commit

Permalink
fix(*): address broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ms2008 committed Jan 20, 2025
1 parent c337b85 commit f085128
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion kong/router/atc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ function _M:exec(ctx)
local fields = self.fields

local req_uri = ctx and ctx.request_uri or var.request_uri
local req_host = lower(get_header("host", ctx))
local req_host = get_header("host", ctx)
req_host = req_host and lower(req_host) or nil

req_uri = strip_uri_args(req_uri)

Expand Down
4 changes: 3 additions & 1 deletion kong/router/traditional.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1755,10 +1755,12 @@ function _M.new(routes, cache, cache_neg)
exec = function(ctx)
local req_method = get_method()
local req_uri = ctx and ctx.request_uri or var.request_uri
local req_host = lower(get_header("host", ctx))
local req_host = get_header("host", ctx)
local req_scheme = ctx and ctx.scheme or var.scheme
local sni = server_name()

req_host = req_host and lower(req_host) or nil

local headers
if match_headers then
local err
Expand Down
4 changes: 2 additions & 2 deletions spec/01-unit/08-router_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"
hosts = {
"domain-1.org",
"domain-2.org",
"Domain-3.org"
"Domain-Capitalized.org"
},
},
},
Expand Down Expand Up @@ -388,7 +388,7 @@ for _, flavor in ipairs({ "traditional", "traditional_compatible", "expressions"

it("[host] matches should be case insensitive", function()
-- host
local match_t = router:select("GET", "/", "domain-3.org")
local match_t = router:select("GET", "/", "domain-capitalized.org")
assert.truthy(match_t)
assert.same(use_case[1].route, match_t.route)
if flavor == "traditional" then
Expand Down

0 comments on commit f085128

Please sign in to comment.