Skip to content

Commit

Permalink
Timeout property at new HttpClient implementation was ignored (#700)
Browse files Browse the repository at this point in the history
* Timeout property at new HttpClient implementation was not working well for .NET Framework

* Reuse conversion to milliseconds.

(cherry picked from commit 81a94df)
  • Loading branch information
claudiamurialdo committed Jan 31, 2023
1 parent 1203557 commit d784c7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dotnet/src/dotnetframework/GxClasses/Domain/GxHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,14 @@ HttpResponseMessage ExecuteRequest(string method, string requestUrl, CookieConta
if (proxy != null)
handler.Proxy = proxy;
HttpResponseMessage response;
TimeSpan milliseconds = TimeSpan.FromMilliseconds(_timeout);
#if !NETCORE
handler.ReceiveDataTimeout = milliseconds;
handler.ReceiveHeadersTimeout = milliseconds;
#endif
using (client = new HttpClient(handler))
{
client.Timeout = TimeSpan.FromMilliseconds(_timeout);
client.Timeout = milliseconds;
client.BaseAddress = request.RequestUri;

using (MemoryStream reqStream = new MemoryStream())
Expand Down

0 comments on commit d784c7d

Please sign in to comment.