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

Fix inconsistent path parameter handling in Router #6

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Conversation

shellfu
Copy link
Owner

@shellfu shellfu commented Jul 30, 2024

The Router's Handle and HandleRoute methods handled path parameters inconsistently. This commit unifies the path parameter handling by ensuring Handle uses the same regex-based transformation as HandleRoute.

Additionally, the test coverage dropped because the ServeHTTP method's handler invocation was not covered. This commit adds a test case that verifies the correct execution of handlers within ServeHTTP, ensuring complete test coverage and addressing the coverage gap.

Changes include:

  • Modified Handle method to use the regex transformation for path parameters.
  • Added test case TestRouter_Handle_ServeHTTP to cover handler execution within ServeHTTP.

This fix closes the issue where path parameters were not recognized when routes were registered using Handle.

Closes #5

…overage

The Router's `Handle` and `HandleRoute` methods handled path parameters inconsistently.
This commit unifies the path parameter handling by ensuring `Handle` uses the same
regex-based transformation as `HandleRoute`.

Additionally, the test coverage dropped because the `ServeHTTP` method's handler
invocation was not covered. This commit adds a test case that verifies the correct
execution of handlers within `ServeHTTP`, ensuring complete test coverage and
addressing the coverage gap.

Changes include:
- Modified `Handle` method to use the regex transformation for path parameters.
- Added test case `TestRouter_Handle_ServeHTTP` to cover handler execution within `ServeHTTP`.

This fix closes the issue where path parameters were not recognized when routes were registered using `Handle`.
@shellfu shellfu merged commit 426617d into main Jul 30, 2024
2 checks passed
@shellfu shellfu deleted the issue_5 branch July 30, 2024 15:12
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.

Inconsistent Path Parameter Handling in Handle and HandleRoute Methods
1 participant