RestSharp прокси http / https / socks информация - PullRequest
0 голосов
/ 30 января 2019

Я хотел узнать, какие прокси совместимы с RestSharp и как их использовать?

1 Ответ

0 голосов
/ 07 февраля 2019

Вы можете использовать System.Net WebProxy, как показано ниже.

var request = new RestRequest(funcName, funcType);
 request.RequestFormat = DataFormat.Json;
 request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json";};
 request.AddBody(param);

RestClient restClient = new RestClient(url);
restClient.Proxy = new WebProxy(myProxyUrl,  myProxyHost);
 restClient.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
var value = restClient.Execute(request);
...