Documentation
¶
Index ¶
- func BadRequest(err error) error
- func Errorf(code int, format string, args ...interface{}) error
- func FromResponse(r *http.Response) error
- func InternalServerError(err error) error
- func IsClientError(code int) bool
- func IsError(code int) bool
- func IsInformational(code int) bool
- func IsRedirect(code int) bool
- func IsServerError(code int) bool
- func IsSuccess(code int) bool
- func MethodNotAllowed(err error) error
- func New(code int, err error) error
- func NotFound(err error) error
- func RespondJSON(w http.ResponseWriter, x interface{}) error
- type Response
- type StatusCoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromResponse ¶
FromResponse creates a new HTTP error from a response
func InternalServerError ¶
InternalServerError creates an HTTP 500 error
func IsClientError ¶
IsClientError checks if code is HTTP client error
func IsInformational ¶
IsInformational checks if code is HTTP informational code
func IsServerError ¶
IsServerError checks if code is HTTP server error
func MethodNotAllowed ¶
MethodNotAllowed creates an HTTP 405 error
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, x interface{}) error
RespondJSON sends a JSON encoded HTTP response
Types ¶
type Response ¶
type Response struct { Message string `json:"message"` Error string `json:"error"` StatusCode int `json:"statusCode"` }
Response is a response message
type StatusCoder ¶
type StatusCoder interface {
StatusCode() int
}
StatusCoder returns an HTTP status code
Click to show internal directories.
Click to hide internal directories.