go-chi/chi

Feature: on Go 1.22 pattern can start with an optional HTTP Method

sonatard opened this issue ยท 5 comments

Since Go 1.22, it has become possible to specify HTTP Methods in the Path. Does chi plan to support this feature?

mux := http.ServeMux()
mux.Handle("GET /user/{id}", userHandler)

golang/go#61410

are you wondering if chi's .Handle() method should also support the method prefix..? we certainly could add support for it pretty easily without any breaking changes. If others want it as well, I'll add it

are you wondering if chi's .Handle() method should also support the method prefix..?

๐Ÿ‘

r := chi.NewRouter()
r.Handle("GET /user/{id}", userHandler)

are you wondering if chi's .Handle() method should also support the method prefix..? we certainly could add support for it pretty easily without any breaking changes. If others want it as well, I'll add it

Can I give it a shot?

I have opened a pull request

merged :) thanks @Spartan09 for the PR