Skip to content

Conversation

@danielroe
Copy link
Member

πŸ”— Linked issue

nuxt/nuxt#33748 (comment)

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

previously it was impossible to force an html response (json: false) if there were certain headers set.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe self-assigned this Jan 5, 2026
@danielroe danielroe requested a review from pi0 as a code owner January 5, 2026 13:03
@vercel
Copy link

vercel bot commented Jan 5, 2026

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

Project Deployment Review Updated (UTC)
nitro.build Ready Ready Preview, Comment Jan 5, 2026 1:03pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

Caution

Review failed

The pull request is closed.

πŸ“ Walkthrough

Walkthrough

A single file modification in the error handling runtime that replaces a logical OR operator with a nullish coalescing operator when determining JSON response format. This changes how the opts.json flag is evaluated, altering the precedence between explicit false values and header-based content negotiation.

Changes

Cohort / File(s) Summary
Error Handling Logic
src/runtime/internal/error/dev.ts
Changed operator from || to ?? for useJSON computation, modifying response format selection. When opts.json is explicitly false, HTML is now forced; null/undefined values fall back to Accept header logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing touches
  • πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/explicit-json-false

πŸ“œ Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 301604f and ed91a8c.

πŸ“’ Files selected for processing (1)
  • src/runtime/internal/error/dev.ts

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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pi0 pi0 changed the title fix(dev): respect opts.json when false fix(dev): respect opts.json when false for error handler Jan 5, 2026
@pi0 pi0 merged commit 656a71e into main Jan 5, 2026
8 of 9 checks passed
@pi0 pi0 deleted the fix/explicit-json-false branch January 5, 2026 13:04
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.

3 participants