NewMethodNotAllowed returns an appropriate error in the case that an HTTP client uses an invalid method (i.e. a GET in place of a POST) on an API endpoint.
(method string)
| 20 | // an HTTP client uses an invalid method (i.e. a GET in place of a POST) |
| 21 | // on an API endpoint. |
| 22 | func NewMethodNotAllowed(method string) *HTTPError { |
| 23 | return &HTTPError{http.StatusMethodNotAllowed, errors.New(`Method is not allowed:"` + method + `"`)} |
| 24 | } |
| 25 | |
| 26 | // NewBadRequest creates a HttpError with the given error and error code 400. |
| 27 | func NewBadRequest(err error) *HTTPError { |
searching dependent graphs…