diff --git a/context/output.go b/context/output.go index 3568d89c..f0e210a2 100644 --- a/context/output.go +++ b/context/output.go @@ -278,55 +278,55 @@ func (output *BeegoOutput) SetStatus(status int) { // IsCachable returns boolean of this request is cached. // HTTP 304 means cached. -func (output *BeegoOutput) IsCachable(status int) bool { +func (output *BeegoOutput) IsCachable() bool { return output.Status >= 200 && output.Status < 300 || output.Status == 304 } // IsEmpty returns boolean of this request is empty. // HTTP 201,204 and 304 means empty. -func (output *BeegoOutput) IsEmpty(status int) bool { +func (output *BeegoOutput) IsEmpty() bool { return output.Status == 201 || output.Status == 204 || output.Status == 304 } // IsOk returns boolean of this request runs well. // HTTP 200 means ok. -func (output *BeegoOutput) IsOk(status int) bool { +func (output *BeegoOutput) IsOk() bool { return output.Status == 200 } // IsSuccessful returns boolean of this request runs successfully. // HTTP 2xx means ok. -func (output *BeegoOutput) IsSuccessful(status int) bool { +func (output *BeegoOutput) IsSuccessful() bool { return output.Status >= 200 && output.Status < 300 } // IsRedirect returns boolean of this request is redirection header. // HTTP 301,302,307 means redirection. -func (output *BeegoOutput) IsRedirect(status int) bool { +func (output *BeegoOutput) IsRedirect() bool { return output.Status == 301 || output.Status == 302 || output.Status == 303 || output.Status == 307 } // IsForbidden returns boolean of this request is forbidden. // HTTP 403 means forbidden. -func (output *BeegoOutput) IsForbidden(status int) bool { +func (output *BeegoOutput) IsForbidden() bool { return output.Status == 403 } // IsNotFound returns boolean of this request is not found. // HTTP 404 means forbidden. -func (output *BeegoOutput) IsNotFound(status int) bool { +func (output *BeegoOutput) IsNotFound() bool { return output.Status == 404 } // IsClientError returns boolean of this request client sends error data. // HTTP 4xx means forbidden. -func (output *BeegoOutput) IsClientError(status int) bool { +func (output *BeegoOutput) IsClientError() bool { return output.Status >= 400 && output.Status < 500 } // IsServerError returns boolean of this server handler errors. // HTTP 5xx means server internal error. -func (output *BeegoOutput) IsServerError(status int) bool { +func (output *BeegoOutput) IsServerError() bool { return output.Status >= 500 && output.Status < 600 }