aboutsummaryrefslogtreecommitdiffhomepage
path: root/http
diff options
context:
space:
mode:
Diffstat (limited to 'http')
-rw-r--r--http/client/response.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/http/client/response.go b/http/client/response.go
index f033d61..d4e3cdc 100644
--- a/http/client/response.go
+++ b/http/client/response.go
@@ -24,6 +24,16 @@ type Response struct {
ContentLength int64
}
+// IsNotFound returns true if the resource doesn't exists anymore.
+func (r *Response) IsNotFound() bool {
+ return r.StatusCode == 404 || r.StatusCode == 410
+}
+
+// IsNotAuthorized returns true if the resource require authentication.
+func (r *Response) IsNotAuthorized() bool {
+ return r.StatusCode == 401
+}
+
// HasServerFailure returns true if the status code represents a failure.
func (r *Response) HasServerFailure() bool {
return r.StatusCode >= 400