Skip to content

fix: read binary extension headers regardless of prefix case - #664

Merged
duglin merged 1 commit into
cloudevents:mainfrom
RaphaelFakhri:fix/566-mixed-case-extension-headers
Nov 6, 2026
Merged

duglin merged 1 commit into
cloudevents:mainfrom
RaphaelFakhri:fix/566-mixed-case-extension-headers

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

Fixes: #566

Proposed Changes

  • Match the ce- extension prefix case-insensitively when HTTP.toEvent() parses a binary-mode message.
  • Skip known attribute headers in any case (for example Ce-Id) so they are not also added as extensions.
  • Add a test for binary messages with mixed-case Ce- headers.

Description

HTTP header names are case-insensitive, and some senders and gateways use canonical header names such as Ce-Myext. parseBinary() reads the spec attributes from the lowercased headers, but looks for extensions in the original headers with a case-sensitive startsWith("ce-"). As a result, an extension sent as Ce-Myext: val is dropped from the event.

The extension name after the prefix keeps its original casing, so the behavior from #420 stays the same: ce-LUNCH still becomes event.LUNCH, and validate() still reports it.

Because the original headers are now matched case-insensitively, the loop also skips headers that map to spec attributes (for example Ce-Id or Ce-Specversion). Without this check they would show up as Id and Specversion extensions.

Tests: npm test (228 passing) and npm run lint pass. The new test fails without the change in src/message/http/index.ts.

Fixes: cloudevents#566
Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
@duglin
duglin merged commit 48b1745 into cloudevents:main Nov 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP headers name case for extensions

2 participants