Skip to content

Commit

Permalink
bugfix #2870
Browse files Browse the repository at this point in the history
  • Loading branch information
b3b00 committed Jan 30, 2024
1 parent c9ddf3e commit 3848a79
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Octokit/Http/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public Task<IApiResponse<T>> Put<T>(Uri uri, object body, string twoFactorAuthen
TimeSpan timeout,
CancellationToken cancellationToken,
string twoFactorAuthenticationCode = null,
Uri baseAddress = null,
Uri baseAddress = null,
Func<object, object> preprocessResponseBody = null)
{
Ensure.ArgumentNotNull(uri, nameof(uri));
Expand Down Expand Up @@ -596,7 +596,8 @@ public async Task<HttpStatusCode> Delete(Uri uri, object data)
Method = HttpMethod.Delete,
Body = data,
BaseAddress = BaseAddress,
Endpoint = uri
Endpoint = uri,
ContentType = "application/json"
};
var response = await Run<object>(request, CancellationToken.None).ConfigureAwait(false);
return response.HttpResponse.StatusCode;
Expand Down Expand Up @@ -722,22 +723,22 @@ async Task<IApiResponse<byte[]>> GetRaw(IRequest request)

return new ApiResponse<byte[]>(response, response.Body as byte[]);
}

async Task<IApiResponse<Stream>> GetRawStream(IRequest request)
{
request.Headers.Add("Accept", AcceptHeaders.RawContentMediaType);
var response = await RunRequest(request, CancellationToken.None).ConfigureAwait(false);

return new ApiResponse<Stream>(response, response.Body as Stream);
}

async Task<byte[]> StreamToByteArray(Stream stream)
{
if (stream is MemoryStream memoryStream)
{
return memoryStream.ToArray();
return memoryStream.ToArray();
}

using (var ms = new MemoryStream())
{
await stream.CopyToAsync(ms);
Expand Down

0 comments on commit 3848a79

Please sign in to comment.