Documentation ¶
Index ¶
- func ErrorResponse(w http.ResponseWriter, r *http.Request, err error)
- func ErrorResponseWithFields(w http.ResponseWriter, r *http.Request, err error, props map[string][]error, ...)
- func ErrorResponseWithStatus(w http.ResponseWriter, r *http.Request, err error, code int)
- func ForbiddenResponse(w http.ResponseWriter, r *http.Request, message string)
- func JSONResponse(w http.ResponseWriter, r *http.Request, data interface{})
- func NotFoundResponse(w http.ResponseWriter, r *http.Request, message string)
- func UnauthorizedResponse(w http.ResponseWriter, r *http.Request)
- type ErrStatusedResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorResponse ¶
func ErrorResponse(w http.ResponseWriter, r *http.Request, err error)
ErrorResponse creates {error: message} json body and responds with error code
func ErrorResponseWithFields ¶
func ErrorResponseWithFields(w http.ResponseWriter, r *http.Request, err error, props map[string][]error, code int)
ErrorResponseWithFields creates error with props
func ErrorResponseWithStatus ¶
ErrorResponseWithStatus creates {error: message} json body and responds with error code
func ForbiddenResponse ¶
func ForbiddenResponse(w http.ResponseWriter, r *http.Request, message string)
ForbiddenResponse creates empty json body and responds with 403 code
func JSONResponse ¶
func JSONResponse(w http.ResponseWriter, r *http.Request, data interface{})
JSONResponse creates json body
func NotFoundResponse ¶
func NotFoundResponse(w http.ResponseWriter, r *http.Request, message string)
NotFoundResponse creates empty json body and responds with 404 code
func UnauthorizedResponse ¶
func UnauthorizedResponse(w http.ResponseWriter, r *http.Request)
UnauthorizedResponse creates empty json body and responds with 401 code
Types ¶
type ErrStatusedResponse ¶
ErrStatusedResponse type
func ErrInternalServer ¶
func ErrInternalServer(message string) *ErrStatusedResponse
ErrInternalServer func
func (*ErrStatusedResponse) Error ¶
func (e *ErrStatusedResponse) Error() string
Click to show internal directories.
Click to hide internal directories.