I ran into a problem of different behaviour of URLSession / URLSessionConfiguration / URLSessionDataTask on OS X and Linux.
Swift: 3.0.2 Kitura: 1.3
I am doing 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()
The additional headers are set on the configuration object, but when deployed to Bluemix the response show that language header field is missing (i get the response in wrong language).
I know that the request is correct because when I build and run this (Kitura) locally (thorough Xcode on OS X) I get the expected behaviour.
Has anyone encountered this? What to do? Where to go?