(fix) RepositoryContentsClient.GetArchive does not return the expected binary content (#2803)

* (GH-2802) Add unit test to demonstrate the problem

This unit test currently fails which demonstrates the problem and it should pass when I am done with the PR

* (GH-2802) Add a GetRaw method that accepts a timeout

I debated adding an optional parameter for the timeout to the existing GetRaw method (which would be my personal preference) but it would be a breaking change and I doubt the Octokit team would be interested in such a change

* (GH-2802) Invoke `GetRaw` rather than `Get>byte[]>` when retrieving a repo's archive content.

This ensure stream content are handled properly and solves the problem described in GitHub issue 2802

* (GH-2802) Fix unit tests that got broken due to my recent change to the GetArchive method

* (GH-2802) Fix formatting

* (GH-2802) Fix more formatting
This commit is contained in:
Jericho
2023-10-16 13:38:12 -04:00
committed by GitHub
parent 7b3abda711
commit 1eac8315ff
4 changed files with 59 additions and 12 deletions
+15 -1
View File
@@ -242,7 +242,21 @@ namespace Octokit
Endpoint = uri.ApplyParameters(parameters)
});
}
/// <inheritdoc/>
public Task<IApiResponse<byte[]>> GetRaw(Uri uri, IDictionary<string, string> parameters, TimeSpan timeout)
{
Ensure.ArgumentNotNull(uri, nameof(uri));
return GetRaw(new Request
{
Method = HttpMethod.Get,
BaseAddress = BaseAddress,
Endpoint = uri.ApplyParameters(parameters),
Timeout = timeout
});
}
/// <inheritdoc/>
public Task<IApiResponse<Stream>> GetRawStream(Uri uri, IDictionary<string, string> parameters)
{