-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support deserializing paths to sequences for multi-component (eg. tail) matches #3432
base: master
Are you sure you want to change the base?
Conversation
actix-web/src/types/path.rs
Outdated
/// } | ||
/// | ||
/// // extract `Tail` from a path using serde | ||
/// #[get("/path/to/{tail:.*}")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please can we use the suggested syntax for tail matches in the tests and docs
https://docs.rs/actix-router/latest/actix_router/struct.ResourceDef.html#tail-segments
/// #[get("/path/to/{tail:.*}")] | |
/// #[get("/path/to/{tail}*")] |
@@ -5,6 +5,7 @@ | |||
## 0.5.3 | |||
|
|||
- Add `unicode` crate feature (on-by-default) to switch between `regex` and `regex-lite` as a trade-off between full unicode support and binary size. | |||
- Add support for extracting multi-component path params into a sequence (Vec, tuple, ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to unreleased section
Updated! |
PR Type
Feature
PR Checklist
Overview
When extracting path parameters with a custom regex matching multiple path components (eg. "/path/to/{tail:.*}"), there is currently no way to percent-decode the components individually. This pull request changes that by adding support for sequences in the path deserializer. When deserializing the path into a Vec or a tuple, the path segment is first split on slashes, then individual path components are percent-decoded and offered to the deserializing type. Empty path components are ignored.
Since the parameter deserializer did not previously support deserializing to a sequence, I expect this to be fully backward compatible.