Currently we are using RestClient
from RestSharp library like below.
var client = new RestClient("<some url>");
var request = new RestRequest("", "GET");
request.AddHeader("content-type", RestClientModel.ContentType);
request.AddParameter("redirect_uri", RedirectUrl);
RestResponse response = await client.ExecuteAsync(request);
return response;
We are facing performance issues while using RestClient
. That's the reason we want to move to HttpClient
. So, we need help on the following points.
- Using
HttpClient
instance inRestClient
constructor which will be injected in respective class which will configure in startup.cs. - What is alternate for
AddParameter
inHttpClient
? As this doesn't seems to be equivalent to adding headers inHttpClient
.
Any help on this appreciated.