Merge pull request #305 from ahmadnurus/add_method_not_allowed_error

errors: Added 405 Method Not Allowed helper function
This commit is contained in:
Asim Aslam 2018-09-13 07:39:42 +01:00 committed by GitHub
commit 52a4beb072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,6 +82,16 @@ func NotFound(id, format string, a ...interface{}) error {
} }
} }
// MethodNotAllowed generates a 405 error.
func MethodNotAllowed(id, format string, a ...interface{}) error {
return &Error{
Id: id,
Code: 405,
Detail: fmt.Sprintf(format, a...),
Status: http.StatusText(405),
}
}
// InternalServerError generates a 500 error. // InternalServerError generates a 500 error.
func InternalServerError(id, format string, a ...interface{}) error { func InternalServerError(id, format string, a ...interface{}) error {
return &Error{ return &Error{