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

Extend Handle method to parse HTTP method in pattern #897

Merged
merged 2 commits into from Jan 18, 2024

Conversation

Spartan09
Copy link
Contributor

Updated the Handle method in the chi router to support patterns that include an HTTP method. This enhancement allows users to specify the HTTP method directly in the route pattern, such as "GET /path". The change is backward compatible, allowing patterns without an HTTP method to be handled as before.

  • Added logic to split the pattern into HTTP method and path.
  • Validated the extracted HTTP method against known methods.
  • Used the existing handle method for routing with the specified method.
  • Ensured backward compatibility for patterns without an HTTP method.
  • Included error handling for unrecognized HTTP methods.
  • Added comprehensive tests to cover new functionality and edge cases.

@pkieltyka
Copy link
Member

thanks for the PR :) will review

@pkieltyka
Copy link
Member

nice work :D LGTM

@pkieltyka pkieltyka merged commit 7446950 into go-chi:master Jan 18, 2024
14 checks passed
@Spartan09 Spartan09 deleted the optional-prefix-method-handle branch January 18, 2024 23:06
mux.go Show resolved Hide resolved
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.

None yet

3 participants