mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Only update response cache for successful api responses Co-authored-by: Nick Floyd <139819+nickfloyd@users.noreply.github.com>
26 lines
837 B
C#
26 lines
837 B
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Octokit.Internal;
|
|
|
|
namespace Octokit
|
|
{
|
|
public static class HttpExtensions
|
|
{
|
|
public static Task<IResponse> Send(this IHttpClient httpClient, IRequest request)
|
|
{
|
|
Ensure.ArgumentNotNull(httpClient, nameof(httpClient));
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
return httpClient.Send(request, CancellationToken.None);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a value that indicates whether the HTTP response was successful.
|
|
/// </summary>
|
|
public static bool IsSuccessStatusCode(this IResponse response)
|
|
{
|
|
Ensure.ArgumentNotNull(response, nameof(response));
|
|
return (int) response.StatusCode >= 200 && (int) response.StatusCode <= 299;
|
|
}
|
|
}
|
|
} |