Steven Giesel 6/10/2024

Does an HttpClient await the Header and the body?

Read Original

This technical article investigates whether awaiting an HttpClient.GetAsync call waits for only the HTTP response headers or the entire body. Using a C#/.NET example with a chunked server response, it demonstrates that the default await waits for the complete body. It then shows how to use HttpCompletionOption.ResponseHeadersRead to await only the headers for performance, while still allowing optional body reading, and discusses the resource management implications.

Does an HttpClient await the Header and the body?

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week