Skip to content

Extend Handle method to parse HTTP method in pattern#897

Merged
pkieltyka merged 2 commits intogo-chi:masterfrom
Spartan09:optional-prefix-method-handle
Jan 18, 2024
Merged

Extend Handle method to parse HTTP method in pattern#897
pkieltyka merged 2 commits intogo-chi:masterfrom
Spartan09:optional-prefix-method-handle

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

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.

3 participants