Skip to content

Commit

Permalink
feat!: upgrade to matchit 0.8.0
Browse files Browse the repository at this point in the history
A copy of #134 but just with the matchit upgrade.

Thank you @matiu2 for raising the original PR
  • Loading branch information
eopb committed Apr 10, 2024
1 parent cb083ad commit 5ecc0f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed `task_local_extensions` in favour of `http::Extensions`.
- All extensions must be `Clone` now.
- Replaced `with_arc` and `with_arc_init` methods with `with_box` and `with_box_init`.
- Support for `matchit` `0.8.0` - This means router matches like `/a/:some_var` need to be changed to `/a/{some_var}`

### Changed
- `RequestBuilder::try_clone` now clones the extensions.
Expand Down
2 changes: 1 addition & 1 deletion reqwest-tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ reqwest-middleware = { version = "0.3.0", path = "../reqwest-middleware" }

anyhow = "1.0.70"
async-trait = "0.1.51"
matchit = "0.7.3"
matchit = "0.8.0"
http = "1"
reqwest = { version = "0.12.0", default-features = false }
tracing = "0.1.26"
Expand Down
4 changes: 2 additions & 2 deletions reqwest-tracing/src/reqwest_otel_span_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ impl OtelPathNames {
///
/// ```
/// # use reqwest_tracing::OtelPathNames;
/// let path_names = OtelPathNames::known_paths(["/payment/:paymentId"]).unwrap();
/// let path_names = OtelPathNames::known_paths(["/payment/{paymentId}"]).unwrap();
/// let path = path_names.find("/payment/payment-id-123");
/// assert_eq!(path, Some("/payment/:paymentId"));
/// assert_eq!(path, Some("/payment/{paymentId}"));
/// ```
pub fn find(&self, path: &str) -> Option<&str> {
self.0.at(path).map(|mtch| mtch.value.as_str()).ok()
Expand Down

0 comments on commit 5ecc0f8

Please sign in to comment.