Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Request::url_mut method #880

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rvolosatovs
Copy link

@rvolosatovs rvolosatovs commented Mar 21, 2022

Add url_mut method counterpart similar to how it's done for other components, e.g. https://docs.rs/tide/latest/tide/struct.Request.html#method.session_mut
Made sure the documentation is consistent with upstream library used https://docs.rs/http-types/latest/http_types/struct.Request.html#method.url

This is useful, for example, in cases where prefix of a route can contain forward-slashes and a request is to be routed to a nested server and custom routing relying on response method needs to be implemented.

For example, if /a/b/c/_myroute and /a/_myroute should call the same route on some Server, then an outer Server implementation could add a route on *, parse the URI from the request, trim the prefix as required and pass the request with modified URI (via url_mut) to the nested Server via Server::respond

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant