0

I have tried looking for the answer but i cant find it if you can please help

  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");

Im using RestSharp 107.3.0 please help if you can

waaffleman420
  • 21
  • 1
  • 3

1 Answers1

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);
Shashikala
  • 61
  • 1
  • 4