mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-02 19:00:47 +00:00
Read binary data based on response content type
The HttpClientAdapter class shouldn't need to know anything about the type we'll eventually deserialize to. In fact, reading binary data was a little hack added _only_ to support images such as emoji and not for general purpose content.
This commit is contained in:
@@ -69,7 +69,10 @@ namespace Octokit.Internal
|
||||
{
|
||||
if (content != null)
|
||||
{
|
||||
if (typeof(T) != typeof(byte[]))
|
||||
var mediaType = responseMessage.Content.Headers.ContentType.MediaType;
|
||||
|
||||
// We added support for downloading images. Let's constrain this appropriately.
|
||||
if (!mediaType.StartsWith("image/"))
|
||||
{
|
||||
responseBody = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user