cloudant / swift-cloudant

A Swift Lang client for Cloudant and CouchDB
Apache License 2.0
42 stars 20 forks source link

Crash in Cloudant tests due to httpAdditionalHeaders [382] #161

Closed saiHemak closed 7 years ago

saiHemak commented 7 years ago

Thanks for your hard work, please ensure all items are complete before opening.

What

/Source/SwiftCloudant/HTTP/URLSession.swift is performing an explicit cast from String to NSString as below which does not work on Linux due to which the test suite crashes on linux while processing the httpAdditionalHeaders by Swift Foundation . config.httpAdditionalHeaders = [("User-Agent" as NSString) as AnyHashable: InterceptableSession.userAgent()].

Moreover, we don't need explicit casting as the String itself can be casted to AnyHashable .

How

Removed explicit casting to NSString

Testing

Running the cloudant test-suite on Linux

Issues

https://github.com/IBM-Swift/SwiftRuntime/issues/382