_client = new JsonApiClient(baseUrl);
_client.GetHttpClient().Timeout = TimeSpan.FromMinutes(10);
It seems like it is not honoring the timeout. Am I doing something wrong?
_client = new JsonApiClient(baseUrl);
_client.GetHttpClient().Timeout = TimeSpan.FromMinutes(10);
It seems like it is not honoring the timeout. Am I doing something wrong?
That’s how you would set the Timeout on the underlying HttpClient
that JsonApiClient
uses.
You can also set a lower limit on a per request basis if you need a lower timeout than the default timeout.
var requestTimeout = TimeSpan.FromSeconds(totalSeconds);
using (var cts = new CancellationTokenSource(requestTimeout))
{
var response = await client.SendAsync(requestDto, cts.Token);
}
Alternatively you can get it to use your own custom configured HttpClient
by passing it in the constructor where its BaseAddress
is configured to the BaseUrl:
var client = new JsonApiClient(MyHttpClient);