We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4890b8 commit efc1f57Copy full SHA for efc1f57
axum-extra/src/extract/cached.rs
@@ -1,4 +1,4 @@
1
-use axum::extract::{Extension, FromRequestParts};
+use axum::extract::FromRequestParts;
2
use http::request::Parts;
3
4
/// Cache results of other extractors.
@@ -88,10 +88,8 @@ where
88
type Rejection = T::Rejection;
89
90
async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
91
- if let Ok(Extension(CachedEntry(value))) =
92
- Extension::<CachedEntry<T>>::from_request_parts(parts, state).await
93
- {
94
- Ok(Self(value))
+ if let Some(value) = parts.extensions.get::<CachedEntry<T>>() {
+ Ok(Self(value.0.clone()))
95
} else {
96
let value = T::from_request_parts(parts, state).await?;
97
parts.extensions.insert(CachedEntry(value.clone()));
0 commit comments