     }
 
     #if os(iOS)
-    public init?(source: String, operation: String, response: HTTPURLResponse?, data: Data?) {
+    public init?(source: String, operation: String, response: URLResponse?, data: Data?) {
+        let response = response as? HTTPURLResponse
         self.source = source
         self.operation = operation
         if let response = response {

            encoding = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding(encodingName as CFString!)))
        }
        else {
            encoding = String.Encoding.utf8
        }
        if let json = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions())
            , let dict = json as? [String:String]

        self.otherInfo = nil
    }

    public init(source: String, operation: String, error: Error) {
        self.source = source
        self.operation = operation
        self.otherInfo = nil
        if let error = error as? NSError, error.domain == "NSURLErrorDomain" {
            switch error.code {
            case -1009:
                self.reason = .noInternet
