What does it really mean that a response in serializer is empty? How do handle such a situation properly? Right now I'm doing something like this but it's fishy. I realize that I could use a custom error type here, but I think I'm not really supposed to handle this situation with some custom impl - without the serializer there is some specific behavior for this after all?
public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> T {
if let error = error {
throw error
}
guard let response = response else {
throw AFError.responseValidationFailed(reason: AFError.ResponseValidationFailureReason.dataFileNil)
}
if (200...299).contains(response.statusCode) { ...
}