mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 03:30:34 +00:00
JsonHttpPipeline only deserializes JSON responses
The JsonHttpPipeline should only try to deserialize responses that have a Content-Type of application/json.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Net.Http;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Octokit.Http
|
||||
{
|
||||
@@ -43,8 +44,11 @@ namespace Octokit.Http
|
||||
{
|
||||
Ensure.ArgumentNotNull(response, "response");
|
||||
|
||||
var json = _serializer.Deserialize<T>(response.Body);
|
||||
response.BodyAsObject = json;
|
||||
if (response.ContentType != null && response.ContentType.Equals("application/json", StringComparison.Ordinal))
|
||||
{
|
||||
var json = _serializer.Deserialize<T>(response.Body);
|
||||
response.BodyAsObject = json;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user