Skip to content

Commit 8d0b99e

Browse files
committed
Adding usage of WebRequest.DefaultWebProxy to address restsharp#1066
1 parent fe2b032 commit 8d0b99e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

RestSharp/RestClient.cs

+8-10
Original file line numberDiff line numberDiff line change
@@ -565,20 +565,18 @@ private void ConfigureHttp(IRestRequest request, IHttp http)
565565
});
566566
}
567567
}
568-
568+
569569
http.AllowedDecompressionMethods = request.AllowedDecompressionMethods;
570570

571-
http.Proxy = Proxy;
572-
573-
#if !NETSTANDARD2_0
574-
if (http.Proxy == null)
575-
http.Proxy = HttpWebRequest.GetSystemWebProxy();
576-
#endif
577-
578-
#if NETSTANDARD2_0
571+
572+
#if !NETSTANDARD2_0
573+
http.Proxy = Proxy ?? (WebRequest.DefaultWebProxy ?? HttpWebRequest.GetSystemWebProxy());
574+
#endif
575+
576+
#if NETSTANDARD2_0
579577
var _ = WebRequest.DefaultWebProxy;
580578
WebRequest.DefaultWebProxy = http.Proxy;
581-
#endif
579+
#endif
582580

583581
http.RemoteCertificateValidationCallback = RemoteCertificateValidationCallback;
584582
}

0 commit comments

Comments
 (0)