Documentation ¶
Index ¶
- func GetQueryParam(r *http.Request, key string) string
- func ReadRequest(r *http.Request, w http.ResponseWriter, v interface{}) (err error)
- func WriteErrorResponse(r *http.Request, w http.ResponseWriter, errorCode int) error
- func WriteResponse(r *http.Request, w http.ResponseWriter, v interface{}) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadRequest ¶
func ReadRequest(r *http.Request, w http.ResponseWriter, v interface{}) (err error)
ReadRequest Parses the request as JSON into the models parameter Errors are logged and should be handled by returning 500
func WriteErrorResponse ¶
WriteErrorResponse writes the passed error code to the response is tries also to resolve a error message (not implemented) The status code is set to 400 BadRequest Errors are logged and should be handled by returning 500
func WriteResponse ¶
func WriteResponse(r *http.Request, w http.ResponseWriter, v interface{}) (err error)
WriteResponse marshals the interface to json and throws on error Errors are logged and should be handled by returning 500
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.