Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix #2870 #2871

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ Task<IApiResponse<T>> SendData<T>(
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 @@ -628,7 +628,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 @@ -754,22 +755,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
Loading