|
|
@@ -168,8 +168,8 @@ public struct URLEncoding: ParameterEncoding {
|
|
|
urlRequest.url = urlComponents.url
|
|
|
}
|
|
|
} else {
|
|
|
- if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil {
|
|
|
- urlRequest.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type")
|
|
|
+ if urlRequest.headers["Content-Type"] == nil {
|
|
|
+ urlRequest.headers.update(.contentType("application/x-www-form-urlencoded; charset=utf-8"))
|
|
|
}
|
|
|
|
|
|
urlRequest.httpBody = Data(query(parameters).utf8)
|
|
|
@@ -265,8 +265,8 @@ public struct JSONEncoding: ParameterEncoding {
|
|
|
do {
|
|
|
let data = try JSONSerialization.data(withJSONObject: parameters, options: options)
|
|
|
|
|
|
- if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil {
|
|
|
- urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
|
+ if urlRequest.headers["Content-Type"] == nil {
|
|
|
+ urlRequest.headers.update(.contentType("application/json"))
|
|
|
}
|
|
|
|
|
|
urlRequest.httpBody = data
|
|
|
@@ -293,8 +293,8 @@ public struct JSONEncoding: ParameterEncoding {
|
|
|
do {
|
|
|
let data = try JSONSerialization.data(withJSONObject: jsonObject, options: options)
|
|
|
|
|
|
- if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil {
|
|
|
- urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
|
+ if urlRequest.headers["Content-Type"] == nil {
|
|
|
+ urlRequest.headers.update(.contentType("application/json"))
|
|
|
}
|
|
|
|
|
|
urlRequest.httpBody = data
|