fix(start-server-core): return 406 instead of 500 for non-HTML Accept headers #7925
Openokxint(GitHub profile, opens in a new tab)wants to merge 2 commits into
main fromrefs/pull/7925/headopened schiller-manuel(GitHub profile, opens in a new tab) requested changes
packages/router-plugin/src/core/code-splitter/compilers.ts line 626@@ -623,4 +623,3 @@623623 ) {624624 programPath.unshiftContainer('body', [625625 template.statement(626- `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`,- packages/start-server-core/src/createStartHandler.ts line 560@@ -557,4 +557,3 @@557557 return normalizeSsrResponse(558558 Response.json(559559 { error: 'Only HTML requests are supported here' },560- { status: 500 },
okxint(GitHub profile, opens in a new tab) linked this to fix #7913
Sign in to join this conversation.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID:
752b3803-61a5-4690-ba28-24ab011a9e7b📥 Commits
Reviewing files that changed from the base of the PR and between a3ee355b5934215ab5716019fbb4b9f55acdd64f and 7a75acfe9ea0e8c6387928604758f4cbfd171531.
📒 Files selected for processing (2)
packages/router-plugin/src/core/code-splitter/compilers.tspackages/start-server-core/src/createStartHandler.ts📝 Walkthrough
Walkthrough#
The change escapes single quotes in generated dynamic imports for two code-splitting strategies and changes unsupported HTML request responses from HTTP 500 to HTTP 406.
Changes#
Code-split import generation
packages/router-plugin/src/core/code-splitter/compilers.tslazyRouteComponentandlazyFnimporter generators escape single quotes insplitUrlbefore creating dynamicimport()calls.HTTP content negotiation
packages/start-server-core/src/createStartHandler.tsAcceptheader excludes HTML and wildcards now receive a 406 JSON error response instead of 500.Estimated code review effort: 2 (Simple) | ~10 minutes
Suggested reviewers:
schiller-manuel,sheraff🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
#7913and appears outside the requested scope.✅ Passed checks (4 passed)
#7913by returning 406 for rejected non-HTML Accept headers.✨ Finishing Touches
🧪 Generate unit tests (beta)
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