Skip to content

fix: validate JSON media types without prefix matching - #4

Open
pralav-25 wants to merge 1 commit into
mainfrom
codex/validate-json-media-type
Open

pralav-25 wants to merge 1 commit into
mainfrom
codex/validate-json-media-type

Conversation

@pralav-25

Copy link
Copy Markdown
Owner

What changes for the learner?

JSON requests using a valid mixed-case Content-Type such as Application/JSON can now save or edit investigations. The reader previously rejected these requests while accepting unsupported lookalikes such as application/jsonp and application/json-seq.

Normalize the media type before its optional parameters and compare it exactly to application/json. Unsupported types return 415 before the request body is consumed.

Model assumptions or compatibility impact

Media type names are case-insensitive under RFC 9110, section 8.3.1. Ordinary JSON requests and parameterized JSON content types continue to work. Prefix lookalikes are now rejected. Experiment models, replay versions, database schema, and interface behavior are unchanged.

Validation

  • Reproduced both regressions before the fix: mixed-case JSON returned 415, and application/jsonp was accepted.
  • pnpm check — all 66 tests pass, plus type checking and lint.
  • pnpm build — included in pnpm build:vercel.
  • pnpm build:vercel — full production build and gateway packaging.
  • Tests cover mixed-case and parameterized JSON, missing content types, prefix lookalikes, combined type values, and rejection before body consumption.
  • Model and interface checks are not applicable to this HTTP parsing change.

@vercel

vercel Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
interleave-pralav Ready Ready Preview Sep 19, 2026 4:07pm UTC

This branch was successfully deployed

1 active deployment
Preview — f316ab8f Deployed Sep 19, 2026 by vercel[bot]
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.

1 participant