Documentation ¶
Overview ¶
Package response provides functions to write HTTP response.
Index ¶
- func WriteBadLicense(w http.ResponseWriter)
- func WriteBadRequestError(w http.ResponseWriter, method, message string)
- func WriteBytes(w http.ResponseWriter, data []byte)
- func WriteDuplicateError(w http.ResponseWriter, method, entity string)
- func WriteEmpty(w http.ResponseWriter)
- func WriteForbiddenError(w http.ResponseWriter)
- func WriteJSON(w http.ResponseWriter, v interface{})
- func WriteMissingDataError(w http.ResponseWriter, method, parameter string)
- func WriteNotFoundError(w http.ResponseWriter, method string, id string)
- func WriteServerError(w http.ResponseWriter, method string, err error)
- func WriteString(w http.ResponseWriter, data string)
- func WriteUnauthorizedError(w http.ResponseWriter)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteBadLicense ¶
func WriteBadLicense(w http.ResponseWriter)
WriteBadLicense notifies HTTP client of invalid license (402)
func WriteBadRequestError ¶
func WriteBadRequestError(w http.ResponseWriter, method, message string)
WriteBadRequestError notifies HTTP client of rejected request due to bad data within request.
func WriteBytes ¶
func WriteBytes(w http.ResponseWriter, data []byte)
WriteBytes dumps bytes to HTTP response
func WriteDuplicateError ¶
func WriteDuplicateError(w http.ResponseWriter, method, entity string)
WriteDuplicateError notifies HTTP client of duplicate data that has been rejected.
func WriteForbiddenError ¶
func WriteForbiddenError(w http.ResponseWriter)
WriteForbiddenError notifies HTTP client of request that is not allowed.
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, v interface{})
WriteJSON serializes data as JSON to HTTP response.
func WriteMissingDataError ¶
func WriteMissingDataError(w http.ResponseWriter, method, parameter string)
WriteMissingDataError notifies HTTP client of missing data in request.
func WriteNotFoundError ¶
func WriteNotFoundError(w http.ResponseWriter, method string, id string)
WriteNotFoundError notifies HTTP client of 'record not found' error.
func WriteServerError ¶
func WriteServerError(w http.ResponseWriter, method string, err error)
WriteServerError notifies HTTP client of general application error.
func WriteString ¶
func WriteString(w http.ResponseWriter, data string)
WriteString writes string to HTTP response
func WriteUnauthorizedError ¶
func WriteUnauthorizedError(w http.ResponseWriter)
WriteUnauthorizedError notifies HTTP client of rejected unauthorized request.
Types ¶
This section is empty.