mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 20:45:51 +00:00
Handle NoContent response for queued operations
We didn't handle the 204 response properly for the `StatisticsClient`. Now we do. Fixes #836
This commit is contained in:
@@ -361,6 +361,22 @@ namespace Octokit.Tests.Http
|
||||
Assert.Same(actualResult,result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WhenGetReturnsNoContentThenReturnsNull()
|
||||
{
|
||||
var queuedOperationUrl = new Uri("anything", UriKind.Relative);
|
||||
|
||||
var result = new object();
|
||||
const HttpStatusCode statusCode = HttpStatusCode.NoContent;
|
||||
IApiResponse<object> response = new ApiResponse<object>(new Response(statusCode, null, new Dictionary<string, string>(), "application/json"), result);
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.GetResponse<object>(queuedOperationUrl, Args.CancellationToken).Returns(Task.FromResult(response));
|
||||
var apiConnection = new ApiConnection(connection);
|
||||
|
||||
var actualResult = await apiConnection.GetQueuedOperation<object>(queuedOperationUrl, Args.CancellationToken);
|
||||
Assert.Null(actualResult);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetIsRepeatedUntilHttpStatusCodeOkIsReturned()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user