I ran into the problem of different behavior of URLSession / URLSessionConfiguration / URLSessionDataTask in OS X and Linux.
Swift: 3.0.2 Kitura: 1.3
I do the following:
let aURL = URL(string: "...")! // Because shared is not implemented let sessionConfig = URLSessionConfiguration.default sessionConfig.httpAdditionalHeaders = ["Accept": "application/json", "Accept-Language": "sv-SE"] let session = URLSession(configuration: sessionConfig) // additionalHeaders are set just fine Log.info("\(session.configuration.httpAdditionalHeaders)") let dataTask = session.dataTask(with: aURL, completionHandler: { data, loadResponse, error in ... }) dataTask.resume()
Additional headers are set on the configuration object, but when deployed to Bluemix, the answer shows that the language header field is missing (I get the answer in the wrong language).
I know that the request is correct, because when I create and run this (Kitura) locally (thorough Xcode on OS X), I get the expected behavior.
Has anyone come across this? What to do? Where to go?
source share