Validation
ecito opened this issue · comments
Andre Navarro commented
currently Request
has .validate()
which only checks if (statusCode < 400)
.
Ideally one could pass in one's own validation block:
.validate() { $0.response.statusCode == 200 }
also nice would be to pass in a validator object such as:
protocol ResponseValidator {
func validate<T>(_ response: Response<T>) -> Bool
}
then .validate(with: SomeServiceValidator())