Skip to content

Commit 57aabff

Browse files
committed
Set Content-Type to application/x-www-form-urlencoded for POST requests
1 parent 1d56e6b commit 57aabff

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Foundation/NSURLSession/NSURLSessionTask.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ fileprivate extension URLSessionTask {
568568
easyHandle.set(requestMethod: request.httpMethod ?? "GET")
569569
if request.httpMethod == "HEAD" {
570570
easyHandle.set(noBody: true)
571+
} else if ((request.httpMethod == "POST") && (request.value(forHTTPHeaderField: "Content-Type") == nil)) {
572+
easyHandle.set(customHeaders: ["Content-Type:application/x-www-form-urlencoded"])
571573
}
572574
}
573575
}

0 commit comments

Comments
 (0)