Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@umputun
Copy link
Member

@umputun umputun commented Dec 6, 2024

This PR simplifies somewhat confusing logic to handle catch-all routes. The most noticeable result is the ability to keep catch-all route handling (i.e., middleware on unregistered routes) and 404 handling in parallel to the registered root handler. It also removes the redundant 'set' flag from rootRegistered and updates the logic to clarify root path handling. To achive it, registered "/" route (pattertn) converted to "/{$}" internally.

Additional tests were added to verify the behavior of root and catch-all handling, custom not found handlers, and concurrent request management.

Removed the redundant 'set' flag from rootRegistered and updated the logic to simplify root path handling. This change ensures that middleware is correctly applied to all routes, including the root, by converting "/" patterns to "/{$}".

 Additional tests were added to verify the behavior of root and catch-all handling, custom not found handlers, and concurrent request management.
@umputun umputun requested a review from paskal December 6, 2024 21:55
Copy link

@paskal paskal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool trick

@umputun umputun merged commit 2027421 into master Dec 7, 2024
4 checks passed
@umputun umputun deleted the better-root-handling branch December 7, 2024 01:11
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