Skip to content

fix(api): accept JSON bodies regardless of content type - #14

Merged
justinwlin merged 2 commits into
mainfrom
zeke/native-route-review-followup
Nov 12, 2026
Merged

justinwlin merged 2 commits into
mainfrom
zeke/native-route-review-followup

Conversation

@KAJdev

@KAJdev KAJdev commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Calling a native API route with curl -X POST https://<worker>/echo -d '{"prompt":"hi"}' could return HTTP 422 because curl labels the JSON as form data. Native body handlers parse one complete JSON object regardless of the content-type header, so this request reaches the handler as {"prompt": "hi"}.

Missing, malformed, null, and non-object bodies return HTTP 422 before the handler runs. Native routes advertise their required JSON-object body in OpenAPI.

Fixes CON-2064

@KAJdev
KAJdev marked this pull request as ready for review November 11, 2026 21:59
@justinwlin
justinwlin self-requested a review November 12, 2026 01:15
@justinwlin
justinwlin merged commit 4d6d58c into main Nov 12, 2026
7 checks passed
@justinwlin
justinwlin deleted the zeke/native-route-review-followup branch November 12, 2026 01:15
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.

2 participants