Repository navigation
fix(core): match event media types case-insensitively - #765
Merged
Merged
Conversation
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>
duglin
force-pushed
the
fix-content-type-case
branch
from
November 12, 2026 16:30
f8184c9 to
29fb2d6
Compare
Contributor
|
LGTM |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the case-insensitive CloudEvents media-type matching change.
No open issues 🎉
What changed in this PR
Fixes #764 by making CloudEvents media-type matching case-insensitive, so mixed-case structured HTTP messages are recognized rather than rejected or routed to the binary reader.
Changes:
- Normalize registered and looked-up type/subtype keys with
Locale.ROOT, without lowercasing parameter values. - Make unsupported CloudEvents media-type prefix detection case-insensitive.
- Add regression coverage for mixed-case registration, lookup, rejection, and structured HTTP reads.
| File | Description |
|---|---|
http/basic/src/test/java/io/cloudevents/http/HttpMessageReaderWriterTest.java |
Tests structured reads with mixed-case content types, parameters, and ce-specversion. |
core/src/test/java/io/cloudevents/core/provider/EventFormatProviderTest.java |
Tests mixed-case format lookup and registration. |
core/src/test/java/io/cloudevents/core/message/impl/MessageUtilsTest.java |
Tests rejection of mixed-case unsupported CloudEvents types. |
core/src/main/java/io/cloudevents/core/provider/EventFormatProvider.java |
Normalizes media-type keys for case-insensitive matching. |
core/src/main/java/io/cloudevents/core/message/impl/MessageUtils.java |
Checks the unsupported CloudEvents prefix case-insensitively. |
Review effort: Balanced
duglin
approved these changes
Nov 12, 2026
Cali0707
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #764.
Mixed-case structured content types are not recognized by
EventFormatProvider. A request withContent-Type: Application/CloudEvents+JSONcan therefore be rejected or incorrectly routed through the binary reader whence-specversionis also present.Normalize type/subtype keys with
Locale.ROOTduring 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 ace-specversionheader.Validation on Temurin 21 / Maven wrapper:
./mvnw -pl http/basic -am verifypasses all 144 tests (API 8, core 97, HTTP 39), with no failures or skips. Javadoc generation also completes for all three modules.git diff --checkpasses.AI assistance was used for investigation, implementation, and validation.