Back to

package response

Latest Go to latest
Published: Aug 29, 2019 | License: AGPL-3.0 | Module:


Package response provides functions to write HTTP response.


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 WriteEmpty

func WriteEmpty(w http.ResponseWriter)

WriteEmpty writes empty JSON HTTP response

func WriteError

func WriteError(w http.ResponseWriter, method string)

WriteError notifies HTTP client of general application error.

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 WriteNotFound

func WriteNotFound(w http.ResponseWriter)

WriteNotFound notifies HTTP client of 'record not found' error.

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier