Documentation ¶
Index ¶
- Variables
- func RespondInternalServerError(w http.ResponseWriter)
- func RespondJSON(w http.ResponseWriter, statusCode int, data interface{})
- func RespondText(w http.ResponseWriter, statusCode int, text string)
- func RespondWithError(w http.ResponseWriter, err error)
- type ErrorResponse
- type PatchOperation
- type PatchRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ForbiddenError = ErrorResponse{ Code: http.StatusForbidden, Message: "forbidden", }
ForbiddenError represents a forbidden error response
View Source
http.StatusUnauthorized, Message: "unauthorized", }Code:
UnauthorizedError represents a unauthorized error response
Functions ¶
func RespondInternalServerError ¶
func RespondInternalServerError(w http.ResponseWriter)
RespondInternalServerError responds with an internal server error response
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, statusCode int, data interface{})
RespondJSON responds with a json with the given status code and data
func RespondText ¶
func RespondText(w http.ResponseWriter, statusCode int, text string)
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, err error)
RespondWithError responds with a json with the given status code and message
Types ¶
type ErrorResponse ¶
ErrorResponse error response
func NewBadRequestError ¶
func NewBadRequestError(msg string) ErrorResponse
NewBadRequestError returns a bad request error response
func NewNotFoundError ¶
func NewNotFoundError(resourceName string) ErrorResponse
NewNotFoundError returns an ErrorResponse with the not found values
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type PatchOperation ¶
type PatchOperation struct { Op string `json:"op"` Path string `json:"path"` Value interface{} `json:"value"` }
PatchOperation represents the request body of a patch request
Click to show internal directories.
Click to hide internal directories.