         for (k, v) in finalHeaders {
           request.addValue(v, forHTTPHeaderField: k)
         }
-        return request as URLRequest
+        return request
       }
 
     }

    let foundCookies: [HTTPCookie]
    if let headers = self.response?.HTTPHeaders, let url = self.response?.url {
      foundCookies = HTTPCookie.cookies(withResponseHeaderFields: headers,
                                        for: url) as [HTTPCookie]
    } else {
      foundCookies = []
    }

      let handler = config.completionHandler
    {
      let result = HTTPResult(
        data: config.data,
        response: task.response,
        error: error,
        task: task
