actix-web icon indicating copy to clipboard operation
actix-web copied to clipboard

Support deserializing paths to sequences for multi-component (eg. tail) matches

Open maartendeprez opened this issue 1 year ago • 1 comments

PR Type

Feature

PR Checklist

  • [x] Tests for the changes have been added / updated.
  • [x] Documentation comments have been added / updated.
  • [x] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt.
  • [x] (Team) Label with affected crates and semver status.

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.

maartendeprez avatar Jul 18 '24 10:07 maartendeprez