Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadContentType is returned when a request has a bad content type. ErrBadContentType = NewError("bad content type", http.StatusUnsupportedMediaType) // ErrBadRequest is returned when a request is bad. ErrBadRequest = NewError("bad request", http.StatusBadRequest) // ErrEmptyBody is returned when a request has an empty body. ErrEmptyBody = NewError("empty body", http.StatusBadRequest) // ErrForbidden is returned when a request is forbidden. ErrForbidden = NewError("forbidden", http.StatusForbidden) // ErrInternal is returned when an internal error occurs. ErrInternal = NewError("internal error", http.StatusInternalServerError) // ErrNotFound is returned when a resource is not found. ErrNotFound = NewError("not found", http.StatusNotFound) // ErrNotSupported is returned when a method is not supported. ErrNotSupported = NewError("not supported", http.StatusMethodNotAllowed) ErrUnauthorized = NewError("unauthorized", http.StatusUnauthorized) // ErrConflict is returned when a request causes a conflict. ErrConflict = NewError("conflict", http.StatusConflict) )
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is an error from an endpoint.
func (*Error) StatusCode ¶
StatusCode implements the StatusCode interface.
type ErrorResponse ¶
type ErrorResponse struct { // Error is the error. Error string `json:"error"` }
ErrorResponse is a response that contains an error.
type Handler ¶
type Handler struct { // NewRequest returns a new request for the handler. NewRequest func() Request // Handle handles the request. Handle Implementation }
Handler is a REST handler.
type Implementation ¶
Implementation is the implementation of a REST endpoint.
type StatusCode ¶
type StatusCode interface { // StatusCode returns the status code of the response. StatusCode() int }
StatusCode is implemented by Responses that have a status code.
Click to show internal directories.
Click to hide internal directories.