Skip to content

Commit 81a94df

Browse files
Timeout property at new HttpClient implementation was ignored (#700)
* Timeout property at new HttpClient implementation was not working well for .NET Framework * Reuse conversion to milliseconds.
1 parent d10bfa0 commit 81a94df

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dotnet/src/dotnetframework/GxClasses/Domain/GxHttpClient.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,9 +652,14 @@ HttpResponseMessage ExecuteRequest(string method, string requestUrl, CookieConta
652652
if (proxy != null)
653653
handler.Proxy = proxy;
654654
HttpResponseMessage response;
655+
TimeSpan milliseconds = TimeSpan.FromMilliseconds(_timeout);
656+
#if !NETCORE
657+
handler.ReceiveDataTimeout = milliseconds;
658+
handler.ReceiveHeadersTimeout = milliseconds;
659+
#endif
655660
using (client = new HttpClient(handler))
656661
{
657-
client.Timeout = TimeSpan.FromMilliseconds(_timeout);
662+
client.Timeout = milliseconds;
658663
client.BaseAddress = request.RequestUri;
659664

660665
using (MemoryStream reqStream = new MemoryStream())

0 commit comments

Comments
 (0)