1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add specific 404 and 401 error messages

This commit is contained in:
Frédéric Guillot 2018-06-30 12:42:12 -07:00
parent a40f592aab
commit 9c0f882ba0
9 changed files with 54 additions and 19 deletions

View file

@ -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