本文整理汇总了C#中RestSharp.RestClient.ExecuteRequestAsync方法的典型用法代码示例。如果您正苦于以下问题:C# RestClient.ExecuteRequestAsync方法的具体用法?C# RestClient.ExecuteRequestAsync怎么用?C# RestClient.ExecuteRequestAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RestSharp.RestClient
的用法示例。
在下文中一共展示了RestClient.ExecuteRequestAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequest
public Task<IRestResponse> ProcessRequest(IRestRequest request, bool secureConnection, CancellationToken cancellationToken, string url = "wp8-ebook.litres.ru")
{
//url = "whub.litres.ru"; // test domen
var client = new RestClient( string.Format( "http{0}://{1}/pages", secureConnection ? "s" : "", url ) );
#if DEBUG
RequestToString(request, client);
#endif
return client.ExecuteRequestAsync( request, cancellationToken );
}
示例2: ProcessCustomRequest
public Task<IRestResponse> ProcessCustomRequest(IRestRequest request, string url, CancellationToken cancellationToken)
{
var client = new RestClient(url);
client.UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)";
return client.ExecuteRequestAsync(request, cancellationToken);
}
示例3: ProcessStaticRequest
public Task<IRestResponse> ProcessStaticRequest( IRestRequest request, CancellationToken cancellationToken )
{
var client = new RestClient( "http://wp8-ebook.litres.ru/static" );
return client.ExecuteRequestAsync( request, cancellationToken );
}