Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
func validate(response: HTTPResponse, forRequest request: HTTPRequest) -> HTTPResponseValidatorResult {
if !(200..<300).contains(response.statusCode) {
// invalid response, we want to fail the request with error
throw HTTPError.invalidResponse
}
return .nextValidator // everything is okay, move to next validator
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment