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:
Haacked
2014-12-31 20:45:42 -08:00
parent 974bbba4e2
commit 37dec8491c
+4 -1
View File
@@ -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);
}