Make IResponse.ContentType readonly

This commit is contained in:
Haacked
2015-01-01 22:05:55 -08:00
parent ff3506f3e8
commit aace9902b9
8 changed files with 76 additions and 53 deletions
+5 -6
View File
@@ -88,12 +88,11 @@ namespace Octokit.Internal
}
}
return new Response(responseMessage.Headers.ToDictionary(h => h.Key, h => h.Value.First()))
{
Body = responseBody,
StatusCode = responseMessage.StatusCode,
ContentType = contentType,
};
return new Response(
responseMessage.StatusCode,
responseBody,
responseMessage.Headers.ToDictionary(h => h.Key, h => h.Value.First()),
contentType);
}
protected virtual HttpRequestMessage BuildRequestMessage(IRequest request)
+14 -1
View File
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using Octokit.Internal;
namespace Octokit.Internal
@@ -19,10 +21,21 @@ namespace Octokit.Internal
ApiInfo = ApiInfoParser.ParseResponseHeaders(headers);
}
public Response(HttpStatusCode statusCode, object body, IDictionary<string, string> headers, string contentType)
{
Ensure.ArgumentNotNull(headers, "headers");
StatusCode = statusCode;
Body = body;
Headers = headers;
ApiInfo = ApiInfoParser.ParseResponseHeaders(headers);
ContentType = contentType;
}
public object Body { get; set; }
public IDictionary<string, string> Headers { get; private set; }
public ApiInfo ApiInfo { get; private set; }
public HttpStatusCode StatusCode { get; set; }
public string ContentType { get; set; }
public string ContentType { get; private set; }
}
}