Fix issue: When a user returns return { ... } from a route instead of return ctx.json({ ... }), throw an er#149
Conversation
…of `return ctx.json({
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4da75b979
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "Use ctx.json({...}) instead of returning an object directly." | ||
|
|
||
| export const isRawObjectResponse = (response: unknown) => | ||
| response !== null && |
There was a problem hiding this comment.
Handle null raw responses before status access
When a handler or route middleware returns null (for example, raw JSON null instead of ctx.json(null)), this predicate returns false, so serializeResponse falls through to rawResponse.status and throws a TypeError rather than the intended raw-response error. The previous check treated null as an invalid raw object response, so this regression leaves one raw JSON value with an unhelpful 500; keep null in the raw-response path or special-case it before dereferencing.
Useful? React with 👍 / 👎.
Addresses: #30
This PR was prepared by a local Codex agent through Revenue Autopilot.
Please review the patch and test evidence before merging.