#5385·NSwag

Specifying ResponseHeadersRead vs ResponseContent read in SendAsync

Author: mattrandleCreated Jun 8, 2026Updated Jul 13, 2026

NSwag-generated C# clients have HttpCompletionOption.ResponseHeadersRead in the generated SendAsync calls.

This is causing me issues with blocked clients - i.e. HttpClient.Timeout only applies until the response headers are received, and response body reads or deserialisation are not covered by that timeout.

Would it be possible to add a CSharpClientGenerator option to choose between ResponseHeadersRead and ResponseContentRead ? defaulting to the current behaviour for compatibility?

I know callers can work around this by creating a linked CancellationTokenSource and passing that token into every generated client call - a lot of work to fix every call site

There is no benefit as far as I can see in every scenario for forcing ResponseHeadersRead vs ResponseContentRead