fix: add cors headers#6733
Conversation
|
""" WalkthroughA new helper function, Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RouteHandler
participant setCorsHeaders
Client->>RouteHandler: Send request (any supported route)
RouteHandler->>setCorsHeaders: Apply CORS headers to response
setCorsHeaders-->>RouteHandler: Headers set
RouteHandler-->>Client: Respond with CORS headers included
Possibly related PRs
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm warn config production Use 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
apps/arclight/src/app/[...route]/route.ts (2)
69-74: Use a strongly‐typed context and leverage Hono’s built-in CORS
The helper is currently declared asc: any, which erases type safety. Import and use Hono’sContexttype (e.g.import type { Context } from 'hono') forc. Moreover, you can replace this custom function entirely by using Hono’s native middleware:import { cors } from 'hono/cors' app.use(cors({ origin: '*' }))This applies CORS headers globally, handles wildcard headers more robustly, and avoids manual header management.
294-295: Centralize CORS injection instead of per-route calls
Every route handler begins withsetCorsHeaders(c), which is repetitive and error-prone. By applying a global middleware (app.use(cors(...))) or registering a single pre-handler for your OpenAPI routes, you eliminate boilerplate and ensure no route is left out.Also applies to: 325-326, 352-353, 375-376, 388-389
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/arclight/src/app/[...route]/route.ts(7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Deploy Preview and Test (arclight, 6733/merge, pull_request, 22)
- GitHub Check: Analyze (javascript)
|
I see you added the "on stage" label, I'll get this merged to the stage branch! |
|
Merge conflict attempting to merge this into stage. Please fix manually. |
|
I see you added the "on stage" label, I'll get this merged to the stage branch! |
Summary by CodeRabbit