Skip to content
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

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

Closed
sonatard opened this issue Jan 13, 2024 · 5 comments
Closed

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

sonatard opened this issue Jan 13, 2024 · 5 comments

Comments

@sonatard
Copy link

sonatard commented Jan 13, 2024

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

@pkieltyka
Copy link
Member

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

@sonatard
Copy link
Author

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

👍

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

@Spartan09
Copy link
Contributor

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?

@Spartan09
Copy link
Contributor

I have opened a pull request

@pkieltyka
Copy link
Member

merged :) thanks @Spartan09 for the PR

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

3 participants