Replies: 1 comment
-
There isn't a way to get the headers "by chunks", and I don't expect there will be. However, getting TTFB is a pretty common ask, and is something that we would like to expose in some sort of metrics API. We just don't have one yet, nor even a proposal. If you're interested in working on one, let me know. It will be part of the next roadmap update (though will require a champion). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to get response headers asynchronously byte by byte (chunk by chunk), the same way we can get response body [1], instead of making a blocking synchronous call [2]? Basically, I'm trying to create a timing utility that returns TTFB (time taken to receive the first byte of response) information for an HTTP request and for that I'd like to get a hook into when the first chunk of response headers is received instead of waiting until all the headers are received which could potentially take multiple reads.
[1]
For example, the following piece of code can be used to get response body
[2]
This gives us the headers in one-shot, but the
send_request(req).await
returns when all the headers have been read and parsed which could take multiple socket reads and the time elapsed could be more than the actual time to first byte.Beta Was this translation helpful? Give feedback.
All reactions