Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Trailing Slash Handling in Routes
This pull request addresses the issue of inconsistent handling of trailing slashes in route patterns. Previously, routes registered with a trailing slash (e.g.,
/issue-48/
) would not match requests without the trailing slash (e.g.,/issue-48
), and vice versa.Changes Made
_register_route
function to normalize route patterns by removing any trailing slashes before registration. This ensures that routes are stored consistently without trailing slashes.Impact
This change ensures that routes function as expected regardless of the presence or absence of a trailing slash in the request URL. Specifically:
POST /issue-48
now correctly match requests to both/issue-48
and/issue-48/
.POST /issue-48/
now also correctly match requests to both/issue-48
and/issue-48/
.This provides a more user-friendly and predictable routing experience.
Testing
Further Considerations
This pull request resolves issue #48 .