Closed zrll12 closed 10 months ago
The documents about trace layer gives the following example:
.on_response(|response: &Response<Body>, latency: Duration, _span: &Span| { tracing::debug!("response generated in {:?}", latency) })
This will generate a error
expected closure signature `for<'a, 'b> fn(&'a Response<http_body::combinators::box_body::UnsyncBoxBody<axum::body::Bytes, axum::Error>>, Duration, &'b Span) -> _` found closure signature `for<'a, 'b> fn(&'a Response<Body>, Duration, &'b Span) -> _`
And could run if change to
.on_response(|response: &Response<http_body::combinators::UnsyncBoxBody<axum::body::Bytes, axum::Error>>, latency: Duration, _span: &Span| { //something });
I wonder if there is a feature that make these two types compatible.
Also, is there a way to get the method and uri in the on_ response closure?
The documents about trace layer gives the following example:
This will generate a error
And could run if change to
I wonder if there is a feature that make these two types compatible.
Also, is there a way to get the method and uri in the on_ response closure?