[英]How do i get the response from a post request? Restsharp
我試過尋找答案,但如果你能幫忙,我找不到它
var options = new RestClientOptions("https://httpbin.org/#/HTTP_Methods/post_post")
{
ThrowOnAnyError = true,
Timeout = 1000
};
var client = new RestClient(options);
var request = new RestRequest()
.AddQueryParameter("foo", "bar");
我正在使用 RestSharp 107.3.0,如果可以,請提供幫助
Use .Result which will give response from both Get and Post method in RestSharp 107.
RestClient client = new("http://baseURL");
RestRequest restRequest = new("api/test");
restRequest.AddQueryParameter("foo", "bar");
RestResponse response = client.ExecuteAsync(restRequest, Method.Post).Result;
Assert.AreEqual(HttpStatusCode.OK, response);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.