Skip to content

Fix issue: When a user returns return { ... } from a route instead of return ctx.json({ ... }), throw an er#149

Open
DoView1 wants to merge 2 commits into
tscircuit:mainfrom
DoView1:codex-maintenance-experiment_mpch5bip_g41bqcul
Open

Fix issue: When a user returns return { ... } from a route instead of return ctx.json({ ... }), throw an er#149
DoView1 wants to merge 2 commits into
tscircuit:mainfrom
DoView1:codex-maintenance-experiment_mpch5bip_g41bqcul

Conversation

@DoView1
Copy link
Copy Markdown

@DoView1 DoView1 commented May 19, 2026

Addresses: #30

This PR was prepared by a local Codex agent through Revenue Autopilot.
Please review the patch and test evidence before merging.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 &&
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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