Skip to content

middleware: allow QUERY method in CORS preflight - #275

Merged
mccutchen merged 1 commit into
mccutchen:mainfrom
marr-cloud:cors-preflight-query
Oct 5, 2026
Merged

mccutchen merged 1 commit into
mccutchen:mainfrom
marr-cloud:cors-preflight-query

Conversation

@marr-cloud

Copy link
Copy Markdown
Contributor

Fixes #274.

Adds QUERY (RFC 10008) to the Access-Control-Allow-Methods header returned for OPTIONS preflight requests, so browsers can send QUERY requests to go-httpbin cross-origin. The options_request case in TestCORS is updated to match.

Checked locally with gofumpt, go vet, revive and go test ./..., plus a manual preflight against a running server:

$ curl -si -X OPTIONS localhost:8080/anything -H 'Origin: https://example.com' -H 'Access-Control-Request-Method: QUERY'
HTTP/1.1 200 OK
Access-Control-Allow-Methods: GET, POST, HEAD, PUT, DELETE, PATCH, QUERY, OPTIONS
...

🤖 Generated with Claude Code

https://claude.ai/code/session_01QGGeu1qW5SA6VugX1iFmZD

Add QUERY (RFC 10008) to the Access-Control-Allow-Methods header
returned for OPTIONS preflight requests, so browsers can send QUERY
requests cross-origin.

Fixes #274

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGGeu1qW5SA6VugX1iFmZD

@mccutchen mccutchen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

👍 thanks!

@mccutchen
mccutchen enabled auto-merge (squash) October 5, 2026 02:00
@marr-cloud

Copy link
Copy Markdown
Contributor Author

The test (stable) failure is just the Codecov upload step — the runner hit a TLS handshake error downloading the Codecov CLI; the test step itself passed. Could you re-run the failed job when you get a chance? Thanks!

@mccutchen
mccutchen merged commit 13bbded into mccutchen:main Oct 5, 2026
8 of 9 checks passed
@codecov

codecov Bot commented Oct 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.77%. Comparing base (34888fd) to head (765eb28).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #275   +/-   ##
=======================================
  Coverage   96.77%   96.77%           
=======================================
  Files           9        9           
  Lines        1798     1798           
=======================================
  Hits         1740     1740           
  Misses         58       58           
Files with missing lines Coverage Δ
httpbin/middleware.go 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marr-cloud
marr-cloud deleted the cors-preflight-query branch October 5, 2026 23:27
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.

CORS preflight: include QUERY (RFC 10008) in Access-Control-Allow-Methods

2 participants