Repository navigation
fix(responses): recognize exact case-insensitive media types - #7768
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared media-type classification src/lib/http-response-semantics.ts, src/server/responses/*, docs-site/src/content/docs/reference/adapters.md, structure/providers/jev-decision.md, structure/transports/* |
hasResponseMediaType matches the trimmed type/subtype before parameters and ignores case. Response consumers use it to classify event-stream and JSON responses. Existing missing-content-type fallbacks and plaintext V2 event validation remain. |
Media-type regression coverage tests/responses/*, tests/routing/combo-stream-preflight.test.ts, tests/server/*, tests/fixtures/test-layout-expected.json, scripts/test-layout/layout*.json |
Tests cover case variations, parameters, unrelated media types, body consumption, passthrough behavior, decision routing, and compaction recovery. Test layout configuration adds the media-type test and moves passthrough mappings to the response layout. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related PRs
- lidge-jun/opencodex#7741: Adds the buffered native Responses required-tool guard that this change updates to use exact JSON media-type matching.
Merge Risk: 
Minimal · previous review 4d469
-
No actionable current-head risk is identified in this change.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title clearly and concisely describes the main change: response handling now recognizes exact media types without case sensitivity. It matches the changes across response routing, decoding, preflight checks, and tests.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
✅ Deterministic PR hygiene checks passed. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
# Conflicts: # tests/fixtures/test-layout-expected.json
# Conflicts: # tests/fixtures/test-layout-expected.json
# Conflicts: # scripts/test-layout/layout.json
# Conflicts: # tests/fixtures/test-layout-expected.json
# Conflicts: # structure/transports/responses-combo-boundaries.md
# Conflicts: # scripts/test-layout/layout.json
|
Maintainer integration into
|
Summary
Internal Responses consumers can mistake a valid
Text/Event-Streamresponse for JSON, or treat an unrelated media type as SSE when a parameter merely mentionstext/event-stream. Use one exact, case-insensitive type/subtype comparison before choosing the decoder.Apply it to JEV decisions, routed compaction, recovery, combo/native stream preflight, native delivery, and the buffered required-tool JSON guard. Preserve the existing missing-header behavior and leave explicitly unrelated bodies unread. Update the owning contracts and regression coverage; HTTP-only V2 fixtures now reject accidental WebSocket construction.
Verification
Current head: 9d02241, a normal merge of dev 9e48f78. All seven PR product-file blobs are unchanged from c4b58b2.
An earlier broad local run reached its 180-second bound at 2,312 passes/3 failures: two quota-fixture failures reproduced on the unchanged base; one sidecar timeout remained unexplained. No full local repository pass or native macOS acceptance is claimed. Native jobs skipped by PR selection are not platform coverage.
The change is ready for maintainer review. Explicit security review remains required before merge.
Checklist
Co-authored-by: Epinephrine luvs01@hanmail.net
Summary by CodeRabbit
Bug Fixes
Documentation
Tests