Created
March 7, 2023 06:08
-
-
Save snowzurfer/f0a5a76ce2d9b595feffb7bb10cc2c86 to your computer and use it in GitHub Desktop.
Check if a `HTTPURLResponse`'s `statusCode` is a 2xx
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
extension HTTPURLResponse { | |
/// Returns `true` if `statusCode` is in range 200...299. | |
/// Otherwise `false`. | |
var is2xx: Bool { | |
return 200 ... 299 ~= statusCode | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment