Skip to content

Commit 3e5282b

Browse files
committed
Fix problem with setting request timeout
The original code could override the http.Timeout with the value of 0 if the RestClient Timeout property was 0. If RestClient.Timeout <= 0, it shouldn't override the http.Timeout.
1 parent db44f42 commit 3e5282b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

RestSharp/RestClient.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ private void ConfigureHttp(IRestRequest request, IHttp http)
369369
http.UserAgent = UserAgent;
370370
}
371371

372-
http.Timeout = request.Timeout == 0 ? Timeout : request.Timeout;
372+
var timeout = request.Timeout > 0 ? request.Timeout : Timeout;
373+
if (timeout > 0)
374+
{
375+
http.Timeout = timeout;
376+
}
373377

374378
#if !SILVERLIGHT
375379
http.FollowRedirects = FollowRedirects;

0 commit comments

Comments
 (0)