|
|
@@ -490,6 +490,8 @@ final class ImageDownloaderSessionHandler: NSObject, URLSessionDataDelegate, Aut
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ var disposition = URLSession.ResponseDisposition.allow
|
|
|
+
|
|
|
if let statusCode = (response as? HTTPURLResponse)?.statusCode,
|
|
|
let url = dataTask.originalRequest?.url,
|
|
|
!(downloader.delegate ?? downloader).isValidStatusCode(statusCode, for: downloader)
|
|
|
@@ -504,9 +506,10 @@ final class ImageDownloaderSessionHandler: NSObject, URLSessionDataDelegate, Aut
|
|
|
}
|
|
|
|
|
|
callCompletionHandlerFailure(error: error, url: url)
|
|
|
+ disposition = .cancel
|
|
|
}
|
|
|
|
|
|
- completionHandler(.allow)
|
|
|
+ completionHandler(disposition)
|
|
|
}
|
|
|
|
|
|
func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
|