Skip to content

Instantly share code, notes, and snippets.

@jaekong
Created January 20, 2021 09:04
Show Gist options
  • Save jaekong/46e3e09daba36af709043c5dccab750e to your computer and use it in GitHub Desktop.
Save jaekong/46e3e09daba36af709043c5dccab750e to your computer and use it in GitHub Desktop.
A simple extension for Vapor 4 to tell if the request was accepted or not.
import Vapor
extension ClientResponse {
var ok: Bool {
get {
return self.status.code >= 200 && self.status.code < 300
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment