Make IResponse.Headers a readonly dictionary

This commit is contained in:
Haacked
2015-01-01 22:12:02 -08:00
parent aace9902b9
commit c2d51570fd
4 changed files with 12 additions and 19 deletions
+2 -4
View File
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Net;
namespace Octokit.Internal
@@ -17,7 +15,7 @@ namespace Octokit.Internal
var body = response.Body is T ? (T)response.Body : default(T);
HttpResponse = response;
Headers = new ReadOnlyDictionary<string, string>(response.Headers);
Headers = response.Headers;
Body = body;
ApiInfo = response.ApiInfo;
StatusCode = response.StatusCode;
+1 -1
View File
@@ -18,7 +18,7 @@ namespace Octokit
public interface IResponse
{
object Body { get; }
IDictionary<string, string> Headers { get; }
IReadOnlyDictionary<string, string> Headers { get; }
ApiInfo ApiInfo { get; }
HttpStatusCode StatusCode { get; }
string ContentType { get; }
+5 -7
View File
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Http;
using Octokit.Internal;
namespace Octokit.Internal
@@ -17,7 +15,7 @@ namespace Octokit.Internal
{
Ensure.ArgumentNotNull(headers, "headers");
Headers = headers;
Headers = new ReadOnlyDictionary<string, string>(headers);
ApiInfo = ApiInfoParser.ParseResponseHeaders(headers);
}
@@ -27,13 +25,13 @@ namespace Octokit.Internal
StatusCode = statusCode;
Body = body;
Headers = headers;
Headers = new ReadOnlyDictionary<string, string>(headers);
ApiInfo = ApiInfoParser.ParseResponseHeaders(headers);
ContentType = contentType;
}
public object Body { get; set; }
public IDictionary<string, string> Headers { get; private set; }
public IReadOnlyDictionary<string, string> Headers { get; private set; }
public ApiInfo ApiInfo { get; private set; }
public HttpStatusCode StatusCode { get; set; }
public string ContentType { get; private set; }