✅ Per request timeout
Is there any way to control the timeout period of a HttpClient on the request side instead of from the client itself? It feels a little bizarre that a class that's recommended to only be instantiated once and shared across the app controls timeouts from the client
4 Replies
I don't think there's a way to set it on a HttpRequestMessage, but you can just use a cancellationtoken on every httpclient method
Pretty sure that's how the client implements the timeout itself as well anyways
@Ploot @Sossenbinder that appears to be 100% accurate per the docs:
https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.timeout?view=net-8.0#remarks
That's a very strange design choice but thank you