Skip to content

Comments

Tag /api/gateway requests with direct-gateway feature header#547

Open
emilieschario wants to merge 1 commit intomainfrom
route-based-headers
Open

Tag /api/gateway requests with direct-gateway feature header#547
emilieschario wants to merge 1 commit intomainfrom
route-based-headers

Conversation

@emilieschario
Copy link
Contributor

Summary

  • Requests hitting /api/gateway/ now have x-kilocode-feature: direct-gateway injected before being forwarded to the openrouter handler
  • Any client-supplied x-kilocode-feature header is overwritten
  • Added tests covering both behaviours

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Feb 25, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Clean change that wraps the gateway route handler to inject the x-kilocode-feature: direct-gateway header before forwarding to the openrouter POST handler. The server-side header injection correctly prevents client spoofing, 'direct-gateway' is a valid FEATURE_VALUES entry, and the NextRequest constructor properly clones the body from the original request. Tests cover both the default case and the overwrite case.

Files Reviewed (2 files)
  • src/app/api/gateway/[...path]/route.ts
  • src/app/api/gateway/[...path]/route.test.ts

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