Documentation
¶
Index ¶
- func HandleBadRequest(response *restful.Response, req *restful.Request, err error)
- func HandleConflict(response *restful.Response, req *restful.Request, err error)
- func HandleError(request *restful.Request, response *restful.Response, err error)
- func HandleForbidden(response *restful.Response, req *restful.Request, err error)
- func HandleInternalError(response *restful.Response, req *restful.Request, err error)
- func HandleNotFound(response *restful.Response, req *restful.Request, err error)
- func HandleTooManyRequests(response *restful.Response, req *restful.Request, err error)
- func HandleUnauthorized(response *restful.Response, req *restful.Request, err error)
- func IgnoreEOF(err error) error
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleBadRequest ¶
func HandleBadRequest(response *restful.Response, req *restful.Request, err error)
HandleBadRequest writes http.StatusBadRequest and log error.
func HandleConflict ¶
func HandleConflict(response *restful.Response, req *restful.Request, err error)
HandleConflict writes http.StatusConflict and log error.
func HandleError ¶
func HandleError(request *restful.Request, response *restful.Response, err error)
HandleError detects proper status code, then write it and log error.
func HandleForbidden ¶
func HandleForbidden(response *restful.Response, req *restful.Request, err error)
HandleForbidden writes http.StatusForbidden and log error.
func HandleInternalError ¶
func HandleInternalError(response *restful.Response, req *restful.Request, err error)
HandleInternalError writes http.StatusInternalServerError and log error.
func HandleNotFound ¶
func HandleNotFound(response *restful.Response, req *restful.Request, err error)
HandleNotFound writes http.StatusNotFound and log error.
func HandleTooManyRequests ¶
func HandleTooManyRequests(response *restful.Response, req *restful.Request, err error)
HandleTooManyRequests writes http.StatusTooManyRequests and log error.
func HandleUnauthorized ¶
func HandleUnauthorized(response *restful.Response, req *restful.Request, err error)
HandleUnauthorized writes http.StatusUnauthorized and log error.
Types ¶
type ResponseWriter ¶
type ResponseWriter struct {
*restful.Response
}
ResponseWriter is a handler for response.
func (ResponseWriter) WriteEntityOrError ¶
func (handler ResponseWriter) WriteEntityOrError(entity interface{}, err error)
WriteEntityOrError writes entity to the response if no error and writes error message to response if error occurred.