axum: Update matchit to 0.8.6 and support capture prefixes and suffixes #3143
+260
−11
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.
Motivation
Closes #3140
matchit
released a new version which now supports prefixes and suffixes in routes like\{image}.png
.Solution
This updates the dependency and makes sure the stripping works properly with the new routes.
Open Questions
matchit
version to0.8.0
(and then later to0.8.4
) because changes like these could introduce problems such as that it would be legal to register paths using new matchit features butaxum
would be broken because it wouldn't know how to work with it. We can continue in the same spirit, locking the version to0.8.6
or we can relax the requirement to not require the same version. I suspect e.g. this issue could have similar effects.\foo
does not match\foo{capture}
might be surprising to users. I've added it to docs about captures but I feel it can be easily overlooked. It is consistent with normal captures which must not be empty either. We could automatically register\foo
along with\foo{capture}
but I'm not sure about that.nest
andnest_service
will be subtly different. In shortnest
should be preferred as it will take into consideration the whole path whilenest_service
will decide which service to call just based on the prefix. More details can be found here. We might consider not allowing partial captures innest_service
prefixes. I wouldn't expect people to run into this but if someone does, the difference might be very surprising.Path
can be confusing when using e.g.\{file}.png
as thePath<String>
extractor will contain only the capture. I don't think we want to change this but I wanted to flag it if anyone thinks we should.