Documentation ¶
Index ¶
- func ApiErrorAlreadyExists(w http.ResponseWriter)
- func ApiErrorGeneral(w http.ResponseWriter)
- func ApiErrorInvalidArgument(w http.ResponseWriter)
- func ApiErrorNotAllowedInCurrentState(w http.ResponseWriter)
- func ApiErrorNotFound(w http.ResponseWriter)
- func ApiErrorResourceInUse(w http.ResponseWriter)
- func ApiErrorUnauthorized(w http.ResponseWriter)
- func ApiErrorUnsupported(w http.ResponseWriter)
- func BadRequest(w http.ResponseWriter, kind string)
- func Decode(r *http.Request, w http.ResponseWriter, val interface{}) bool
- func New(u *url.URL, r *simulator.Registry) ([]string, http.Handler)
- func OK(w http.ResponseWriter, val ...interface{})
- func StatusOK(w http.ResponseWriter, val ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiErrorAlreadyExists ¶ added in v0.31.0
func ApiErrorAlreadyExists(w http.ResponseWriter)
ApiErrorAlreadyExists responds with a REST error of type "ALREADY_EXISTS". For use with "/api" endpoints.
func ApiErrorGeneral ¶ added in v0.31.0
func ApiErrorGeneral(w http.ResponseWriter)
ApiErrorGeneral responds with a REST error of type "ERROR". For use with "/api" endpoints.
func ApiErrorInvalidArgument ¶ added in v0.31.0
func ApiErrorInvalidArgument(w http.ResponseWriter)
ApiErrorInvalidArgument responds with a REST error of type "INVALID_ARGUMENT". For use with "/api" endpoints.
func ApiErrorNotAllowedInCurrentState ¶ added in v0.31.0
func ApiErrorNotAllowedInCurrentState(w http.ResponseWriter)
ApiErrorNotAllowedInCurrentState responds with a REST error of type "NOT_ALLOWED_IN_CURRENT_STATE". For use with "/api" endpoints.
func ApiErrorNotFound ¶ added in v0.31.0
func ApiErrorNotFound(w http.ResponseWriter)
ApiErrorNotFound responds with a REST error of type "NOT_FOUND". For use with "/api" endpoints.
func ApiErrorResourceInUse ¶ added in v0.31.0
func ApiErrorResourceInUse(w http.ResponseWriter)
ApiErrorResourceInUse responds with a REST error of type "RESOURCE_IN_USE". For use with "/api" endpoints.
func ApiErrorUnauthorized ¶ added in v0.31.0
func ApiErrorUnauthorized(w http.ResponseWriter)
ApiErrorUnauthorized responds with a REST error of type "UNAUTHORIZED". For use with "/api" endpoints.
func ApiErrorUnsupported ¶ added in v0.31.0
func ApiErrorUnsupported(w http.ResponseWriter)
ApiErrorUnsupported responds with a REST error of type "UNSUPPORTED". For use with "/api" endpoints.
func BadRequest ¶ added in v0.22.0
func BadRequest(w http.ResponseWriter, kind string)
BadRequest responds with http.StatusBadRequest and json encoded vAPI error of type kind. For use with "/rest" endpoints where the response is a "value" wrapped structure.
func Decode ¶ added in v0.22.0
func Decode(r *http.Request, w http.ResponseWriter, val interface{}) bool
Decode the request Body into val. Returns true on success, otherwise false and sends the http.StatusBadRequest response.
func OK ¶ added in v0.22.0
func OK(w http.ResponseWriter, val ...interface{})
OK responds with http.StatusOK and encodes val, if specified, to JSON For use with "/rest" endpoints where the response is a "value" wrapped structure.
func StatusOK ¶ added in v0.24.0
func StatusOK(w http.ResponseWriter, val ...interface{})
StatusOK responds with http.StatusOK and encodes val, if specified, to JSON For use with "/api" endpoints.
Types ¶
This section is empty.