The incoming JSON from MockURL200Session produces a value of 2017-11-25 09:47:18 Etc/GMT
.
class MockURL200Session: URLSessionProtocol {
var nextDataTask = MockURLSessionDataTask()
var nextData: Data?
var nextError: Error?
func httpURLResponse(request: NSURLRequest) -> URLResponse {
return HTTPURLResponse(url: request.url!, statusCode: 200, httpVersion: "HTTP/1.1", headerFields: nil)!
}
func dataTask(with request: NSURLRequest, completionHandler: @escaping DataTaskResult) -> URLSessionDataTaskProtocol {
let json = ["expires_date": "2017-11-25 09:47:18 Etc/GMT"]
nextData = try! JSONSerialization.data(withJSONObject: json, options: [])
completionHandler(nextData, httpURLResponse(request: request), nextError)
return nextDataTask as URLSessionDataTaskProtocol
}
}
However, once it arrives on the client side the forward slash simply disappears and becomes 2017-11-25 09:47:18 Etc GMT
self.httpClient.post(url: url) { (data, response, error) in
let json = try! JSONSerialization.jsonObject(with: data!, options: []) as! Dictionary<String, Any>
}
How can I prevent it or escape it?