I have been trying to troubleshoot an issue with task cancellation and stumbled on the below.
https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/
https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?redirectedfrom=MSDN&view=net-6.0#Remarks
Looks like the best practice is to re-use HttpClient across multiple requests.
In looking at the code, I would probably implement the RequestHandler as static inside AbstractClient. It can be reused for all requests for the lifetime of an instance of OnlineClient. Inside that I would implement HttpClient as static in the same way.
I have been trying to troubleshoot an issue with task cancellation and stumbled on the below.
https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/
https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?redirectedfrom=MSDN&view=net-6.0#Remarks
Looks like the best practice is to re-use HttpClient across multiple requests.
In looking at the code, I would probably implement the RequestHandler as static inside AbstractClient. It can be reused for all requests for the lifetime of an instance of OnlineClient. Inside that I would implement HttpClient as static in the same way.