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 routing for opaque nested services #842

Merged
merged 5 commits into from
Mar 9, 2022
Merged

Conversation

davidpdrsn
Copy link
Member

@davidpdrsn davidpdrsn commented Mar 8, 2022

Fixes #830

This brings nesting of opaque services inline with nesting Routers, except for one case which is explained in a test. Also added a bunch more comments to the prefix stripping so I'll still be able to understanding it two days from now 😅

@davidpdrsn davidpdrsn marked this pull request as ready for review March 8, 2022 22:06
@davidpdrsn davidpdrsn requested a review from jplatte March 8, 2022 22:06
let path = if path == "/" {
format!("/*{}", NEST_TAIL_PARAM)
let path = if path.ends_with('/') {
format!("{}*{}", path, NEST_TAIL_PARAM)
Copy link
Member Author

Choose a reason for hiding this comment

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

Before we would add a double slash to nest("/foo/", _).

@@ -183,7 +199,7 @@ mod tests {
single_segment_root_prefix,
uri = "/a",
prefix = "/",
expected = None,
expected = Some("/a"),
Copy link
Member Author

Choose a reason for hiding this comment

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

The outcome of this is the same. Not matching the prefix or matching and removing nothing from the path is equivalent.

uri = "/a/a",
prefix = "/a/",
expected = Some("/a"),
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Case that wasn't handled properly before.

@davidpdrsn davidpdrsn enabled auto-merge (squash) March 8, 2022 22:09
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
@davidpdrsn davidpdrsn merged commit 401c7a3 into main Mar 9, 2022
@davidpdrsn davidpdrsn deleted the fix-opaque-nested-services branch March 9, 2022 10:25
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.

Tests for truly nested routing?
2 participants