shortcut / NetworkKit

Networking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validation

ecito opened this issue · comments

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())