Documentation ¶
Overview ¶
Package api contains helpers to work with HTTP requests and responses.
Index ¶
- func ReadJSON(r *http.Request, v interface{}) error
- func SendBadRequestError(w http.ResponseWriter, r *http.Request, message string)
- func SendError(w http.ResponseWriter, r *http.Request, err error)
- func SendNotFoundError(w http.ResponseWriter, r *http.Request)
- func SendUnauthorizedError(w http.ResponseWriter, r *http.Request)
- func WriteData(w http.ResponseWriter, httpStatusCode int, b []byte) error
- func WriteJSON(w http.ResponseWriter, httpStatusCode int, v interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendBadRequestError ¶
func SendBadRequestError(w http.ResponseWriter, r *http.Request, message string)
SendBadRequestError sends a bad request error.
func SendError ¶
func SendError(w http.ResponseWriter, r *http.Request, err error)
SendError sends a server error.
func SendNotFoundError ¶
func SendNotFoundError(w http.ResponseWriter, r *http.Request)
SendNotFoundError sends a not found error.
func SendUnauthorizedError ¶
func SendUnauthorizedError(w http.ResponseWriter, r *http.Request)
SendUnauthorizedError sends an unauthorized request error.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.