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

feat: update HTTP method parsing in patterns for Handle and HandleFunc #900

Merged
merged 5 commits into from
Feb 17, 2024

Conversation

angelofallars
Copy link
Contributor

Resolves #899

Makes the Mux.HandleFunc method also support patterns that include an HTTP method. This is the behavior consistent with Go 1.22's net/http.ServeMux. Previously, only Mux.Handle supported HTTP method patterns according to #897 .

  • Made Mux.HandleFunc call Mux.Method when a method pattern is detected.
  • Refactored Mux.Handle to call Mux.Method instead. Error handling for unrecognized HTTP methods is still kept this way.
  • Updated TestMuxHandlePatternValidation to also test Mux.HandleFunc.

@floleg
Copy link

floleg commented Feb 16, 2024

Hi @angelofallars! Thanks for this improvement which will be very much appreciated.

Once merged, have you any idea when we can expect to have it shipped on a new release?

Thanks again, and have a great day!

@pkieltyka pkieltyka merged commit 60b4f5f into go-chi:master Feb 17, 2024
@pkieltyka
Copy link
Member

thanks @angelofallars

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.

bug: HandlerFunc does not support HTTP methods in patterns like #897
3 participants