Documentation ¶
Index ¶
- 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 BadRequest ¶
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 ¶
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 ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.