How to use PrivateCookieJar in middleware #2171
-
I have been trying to use PrivateCookieJar to manage cookie but wasn't able to get it compile. My middleware looks like this pub async fn cookie_middleware<B>(
cookie_jar: PrivateCookieJar,
mut request: Request<B>,
next: Next<B>,
) -> impl IntoResponse { I am adding as a layer like this.
I got this error ^ the trait `Service<axum::http::Request<_>>` is not implemented for
`axum::middleware::FromFn<fn(axum_extra::extract::cookie::private::PrivateCookieJar, axum::http::Request<_>, Next<_>) ->
impl std::future::Future<Output = impl IntoResponse> {cookie_middleware::<_>}, (), Route, _>` It compiles again when I remove |
Beta Was this translation helpful? Give feedback.
Answered by
michaelkimchi
Aug 13, 2023
Replies: 1 comment 1 reply
-
I managed to get it compiled after adding an
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
davidpdrsn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I managed to get it compiled after adding an
app_state
and doimpl FromRef<AppState> for Key
debug_middleware
might be helpful in this case. #1993