Created
March 15, 2022 19:22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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