From 0bdb2b6ef4c955c1fe06fa101d974f88ecc2b9f3 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Wed, 10 Apr 2024 09:05:51 +0100 Subject: [PATCH] feat!: upgrade to matchit `0.8.0` (#140) A copy of #134 but just with the matchit upgrade. Thank you @matiu2 for raising the original PR --- CHANGELOG.md | 1 + reqwest-tracing/Cargo.toml | 2 +- reqwest-tracing/src/reqwest_otel_span_builder.rs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e55969e..2055a08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/reqwest-tracing/Cargo.toml b/reqwest-tracing/Cargo.toml index 08386f7..31587df 100644 --- a/reqwest-tracing/Cargo.toml +++ b/reqwest-tracing/Cargo.toml @@ -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" diff --git a/reqwest-tracing/src/reqwest_otel_span_builder.rs b/reqwest-tracing/src/reqwest_otel_span_builder.rs index 7ab94e0..c425eb8 100644 --- a/reqwest-tracing/src/reqwest_otel_span_builder.rs +++ b/reqwest-tracing/src/reqwest_otel_span_builder.rs @@ -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()