Documentation ¶
Index ¶
Constants ¶
View Source
const (
MethodGET = "GET"
)
Common HTTP methods and header values
Variables ¶
This section is empty.
Functions ¶
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, code int, err error)
RespondWithError provides an auxiliary function to handle all failed HTTP requests.
func RespondWithJSON ¶
func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})
RespondWithJSON provides an auxiliary function to return an HTTP response with JSON content and an HTTP status code.
Types ¶
type ErrResponse ¶
type ErrResponse struct {
Error string `json:"error"`
}
ErrResponse defines an HTTP error response.
Click to show internal directories.
Click to hide internal directories.