Signature of the on_response closure
zrll12 opened this issue · 0 comments
zrll12 commented
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?