When URLSession.dataTask(with request: URLRequest, completionHandler:) returns a nil error, is the URLResponse response parameter guaranteed to be an HTTPURLResponse, so that it is safe to force downcast the URLResponse to an HTTPURLResponse?
This article does not force cast the URLResponse to an HTTPURLResponse when there is no error:
These examples do:
https://developer.apple.com/documentation/network/debugging_http_server-side_errors
https://forums.developer.apple.com/message/351326#351326
Thanks!