Skip to content

fix(core): match event media types case-insensitively - #765

Open
yangjj-iso wants to merge 1 commit into
cloudevents:mainfrom
yangjj-iso:fix-content-type-case
Open

yangjj-iso wants to merge 1 commit into
cloudevents:mainfrom
yangjj-iso:fix-content-type-case

Conversation

@yangjj-iso

Copy link
Copy Markdown

Fixes #764.

Mixed-case structured content types are not recognized by EventFormatProvider. A request with Content-Type: Application/CloudEvents+JSON can therefore be rejected or incorrectly routed through the binary reader when ce-specversion is also present.

Normalize type/subtype keys with Locale.ROOT during registration and lookup, preserving parameter values. Make the unsupported CloudEvents prefix check case-insensitive as well, so capitalization does not change the existing rejection behavior. This follows the HTTP binding §3; event data and header values are unchanged.

Regression coverage exercises mixed-case lookup and registration, unsupported content types, and structured reads through HttpMessageFactory, including parameters and a ce-specversion header.

Validation on Temurin 21 / Maven wrapper:

  • Original implementation: seven selected core cases and two HTTP cases fail; the lowercase HTTP control passes.
  • Final implementation: ./mvnw -pl http/basic -am verify passes all 144 tests (API 8, core 97, HTTP 39), with no failures or skips. Javadoc generation also completes for all three modules.
  • git diff --check passes.
  • Full-repository tests were not run.

AI assistance was used for investigation, implementation, and validation.

Normalize media type keys with Locale.ROOT when registering and resolving
formats, while retaining parameter values. Match unsupported CloudEvents
media type prefixes consistently across case variants.

Add registry, routing, and public HTTP reader regression coverage.

Fixes cloudevents#764

Signed-off-by: redyyang <3202137046@qq.com>

This branch has not been deployed

No deployments
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.

Structured CloudEvents media types are matched case-sensitively

1 participant