Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions spec/unit/features/descriptor.feature
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Feature: Descriptor extraction and claim resolution
Scenario: AC-7b header limit_key with hyphens matches OpenResty normalized key with underscores
Given limit_keys is "header:x-e2e-key"
And header "x_e2e_key" is "exhaust-abc123"

Scenario: AC-7c uppercase header limit_key matches OpenResty normalized key (lowercase + underscore)
Given limit_keys is "header:X-E2E-Key"
And header "x_e2e_key" is "exhaust-abc123"
When I extract descriptors
Then descriptor "header:x-e2e-key" is "exhaust-abc123"
And missing keys are empty
Expand Down
6 changes: 3 additions & 3 deletions src/fairvisor/descriptor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ function _M.extract(limit_keys, request_context)
value = headers[name]
if value == nil then
-- OpenResty normalizes header names: lowercase and hyphen to underscore (e.g. X-E2E-Key -> x_e2e_key).
local name_underscore = string_gsub(name, "-", "_")
local name_lower = string_lower(name)
value = headers[name_underscore] or headers[name_lower]
-- Use _normalize_header_name so both transformations are applied together; the two-step
-- approach (hyphen→underscore OR lowercase separately) misses uppercase+hyphenated keys.
value = headers[_normalize_header_name(name)]
end
if value == nil then
local name_norm = _normalize_header_name(name)
Expand Down
Loading