Skip to content

fix(server): send an Allow header with 405 responses - #434

Merged
anurag629 merged 2 commits into
codercops:devfrom
prakashNalla:fix/405-allow-header
Oct 28, 2026
Merged

anurag629 merged 2 commits into
codercops:devfrom
prakashNalla:fix/405-allow-header

Conversation

@prakashNalla

Copy link
Copy Markdown
Contributor

What does this change?

405 responses now include Allow: POST, OPTIONS, the same methods the preflight sends in Access-Control-Allow-Methods. Both paths are covered: fetchChatResponse in http.ts (Vercel, Cloudflare, and the session endpoint, which is routed after the method check) and the 405 branch in the Express adapter. The 405 row in protocol.mdx mentions the header, and there's a patch changeset for @chatcops/server.

Closes #431

How I tested this

The existing "returns 405" tests in tests/adapters/vercel.test.ts, cloudflare.test.ts and express.test.ts now also check the Allow header. With the two source changes reverted, those 3 tests fail.

  • pnpm -r build and pnpm -r typecheck: pass
  • pnpm test: 129 files passed (5 skipped), 1748 tests passed
  • pnpm test:coverage: passes
  • pnpm lint: passes
  • pnpm docs:check: 132 TypeScript blocks checked

AI assistance

Claude helped me w/ understand the issue

Checklist

  • This PR targets dev
  • I was assigned the linked issue
  • pnpm -r build, pnpm test and pnpm -r typecheck pass locally
  • Tests added or updated where it makes sense
  • For a bug fix: the new test fails without my change
  • Changeset added (pnpm changeset) if this changes core, widget or server
  • Docs updated if behavior or options changed

@anurag629 anurag629 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this is right. Both 405 paths get the header, and it matches the preflight's methods. I merged it with current dev locally: build, typecheck, test:coverage, lint (same warnings as dev) and docs:check pass, and the three adapter tests fail with the two source lines reverted. Merging once CI is green on the updated branch.

@anurag629
anurag629 merged commit 5e34537 into codercops:dev Oct 28, 2026
5 checks passed
@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 28, 2026
@anurag629

Copy link
Copy Markdown
Member

Merged, thanks @prakashNalla. It goes out with the next server release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server: 405 responses don't include an Allow header

2 participants