diff --git a/src/Qiniu/Http/HttpManager.cs b/src/Qiniu/Http/HttpManager.cs index b1098f9..3d202de 100644 --- a/src/Qiniu/Http/HttpManager.cs +++ b/src/Qiniu/Http/HttpManager.cs @@ -112,14 +112,15 @@ public HttpResult Get(string url, StringDictionary headers, string token, bool b wReq.Method = "GET"; if (headers != null) { - foreach (string fieldName in headers.Keys) + if (headers.ContainsKey("Content-Type")) { - wReq.Headers.Add(fieldName, headers[fieldName]); + wReq.ContentType = headers["Content-Type"]; + headers.Remove("Content-Type"); } - if (headers.ContainsKey("Content-Type")) + foreach (string fieldName in headers.Keys) { - wReq.ContentType = headers["Content-Type"]; + wReq.Headers.Add(fieldName, headers[fieldName]); } } if (!string.IsNullOrEmpty(token)) @@ -262,14 +263,15 @@ public HttpResult Post(string url, StringDictionary headers, string token, bool wReq.Method = "POST"; if (headers != null) { - foreach (string fieldName in headers.Keys) + if (headers.ContainsKey("Content-Type")) { - wReq.Headers.Add(fieldName, headers[fieldName]); + wReq.ContentType = headers["Content-Type"]; + headers.Remove("Content-Type"); } - if (headers.ContainsKey("Content-Type")) + foreach (string fieldName in headers.Keys) { - wReq.ContentType = headers["Content-Type"]; + wReq.Headers.Add(fieldName, headers[fieldName]); } } if (!string.IsNullOrEmpty(token))