From 70306ec26fb6bf177af74dfee2761117ccafbe93 Mon Sep 17 00:00:00 2001 From: Patrick Butkiewicz Date: Mon, 10 Oct 2016 21:25:44 -0400 Subject: [PATCH] Set Content-Type correctly for Jenkins --- Sources/APIClient.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/APIClient.swift b/Sources/APIClient.swift index a9f7086..96832aa 100644 --- a/Sources/APIClient.swift +++ b/Sources/APIClient.swift @@ -98,8 +98,11 @@ internal final class APIClient: NSObject { _ = headers.map { request.addValue($0.value, forHTTPHeaderField: $0.key) } + if method == .POST { + request.addValue("Content-Type: application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type") + } + if let body = body { - request.addValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type") request.httpBody = body } else { var components = URLComponents(url: url, resolvingAgainstBaseURL: false)