errors: Added 405 Method Not Allowed helper function

This commit is contained in:
ahmadnurus 2018-09-12 21:42:34 +07:00
parent 3732dc2f42
commit 395d70cf01

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.
func InternalServerError(id, format string, a ...interface{}) error {
return &Error{