mirror of
https://github.com/go-micro/go-micro.git
synced 2025-07-12 22:41:07 +02:00
Merge pull request #305 from ahmadnurus/add_method_not_allowed_error
errors: Added 405 Method Not Allowed helper function
This commit is contained in:
@ -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{
|
||||
|
Reference in New Issue
Block a user