mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
BREAKING CHANGE (behavior): Modify caching to only attempt to update the response cache if a 2xx response code is received from GitHub (#2877)
Only update response cache for successful api responses Co-authored-by: Nick Floyd <139819+nickfloyd@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user