Skip to content

Support for HTTP OPTIONS Method in New String Pattern Matching for Handle and HandleFunc #69425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
coker-felix opened this issue Sep 12, 2024 · 2 comments

Comments

@coker-felix
Copy link

What version of Go are you using (go version)?

Support for HTTP OPTIONS Method in New String Pattern Matching for Handle and HandleFunc

$ go version
go version go1.23.0 darwin/amd64

Does this issue reproduce with the latest release?

Issue introduced in go version 1.22 https://go.dev/blog/routing-enhancements and still reproduce with the latest release

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/example/Library/Caches/go-build'
GOENV='/Users/example/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/example/go/pkg/mod'
GOOS='darwin'
GOPATH='/Users/example/go'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/Cellar/go/1.23.0/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/Cellar/go/1.23.0/libexec/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/example/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/example/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/37/2js67n8d49sbrr84_8qc7pxm0000gn/T/go-build2994275656=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOROOT/bin/go version: go version go1.23.0 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.23.0
uname -v: Darwin Kernel Version 23.2.0: Wed Nov 15 21:54:10 PST 2023; root:xnu-10002.61.3~2/RELEASE_X86_64
ProductName:		macOS
ProductVersion:		14.2.1
BuildVersion:		23C71
lldb --version: lldb-1500.0.200.58
Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)

What did you do?

  1. I created an HTTP server using the standard library.
  2. I implemented route handling with the new string pattern matching feature.
  3. I expected the new feature to handle requests using the HTTP OPTIONS method, but it did not handle my use case.

What did you expect to see?

HTTP Methods GET, POST, PUT, DELETE all match a special case OPTIONS just as GET also matches HEAD

What did you see instead?

When I made a request with the HTTP OPTIONS method to the route, the server responded with an HTTP 404 Not Found error instead of processing the request as expected.

@coker-felix
Copy link
Author

@gabyhelp Thanks

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

No branches or pull requests

2 participants