Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tower_http::trace::OnEos only called if EOS is classified #550

Open
AlphaKeks opened this issue Mar 15, 2025 · 0 comments
Open

tower_http::trace::OnEos only called if EOS is classified #550

AlphaKeks opened this issue Mar 15, 2025 · 0 comments

Comments

@AlphaKeks
Copy link

It seems a bit odd to me that when using ServerErrorsAsFailures (the default classifier used by TraceLayer::new_for_http()), the OnEos callback is never called. After looking at the code, I found that the response body only carries the callback if the response could not yet be classified: https://docs.rs/tower-http/0.6.2/src/tower_http/trace/future.rs.html#83

I thought if OnBodyChunk is called each time the body is (successfully) polled, I would also get a callback for when it's done, but the way the traits are organized, I don't think I can get what I want without changing tower_http's internals. Is there a reason for why these need to be tied together, or was this just an oversight? Or perhaps I'm missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant