Documentation ¶
Overview ¶
Package writer contains utilities for writing responses in the server.
Index ¶
- func Bytes(w http.ResponseWriter, code int, bs []byte)
- func Error(w http.ResponseWriter, status int, err *types.ErrorV1)
- func ErrorAuto(w http.ResponseWriter, err error)
- func ErrorString(w http.ResponseWriter, status int, code string, err error)
- func JSON(w http.ResponseWriter, code int, v interface{}, pretty bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
func Bytes(w http.ResponseWriter, code int, bs []byte)
Bytes writes a response with the specified status code and bytes.
func Error ¶
func Error(w http.ResponseWriter, status int, err *types.ErrorV1)
Error writes a response with specified status and error response.
func ErrorAuto ¶
func ErrorAuto(w http.ResponseWriter, err error)
ErrorAuto writes a response with status and code set automatically based on the type of err.
func ErrorString ¶
func ErrorString(w http.ResponseWriter, status int, code string, err error)
ErrorString writes a response with specified status, code, and message set to the the err's string representation.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.