Documentation ¶
Index ¶
- func DecodeRequest(w http.ResponseWriter, r *http.Request, log logrus.FieldLogger, ...) (ok bool)
- func EncodeResponse(w http.ResponseWriter, r *http.Request, log logrus.FieldLogger, ...) (ok bool)
- func LogInternalError(log logrus.FieldLogger, respMsg string, internalErr error)
- func ProcessError(ctx context.Context, w http.ResponseWriter, respMsg string, code int)
- func ProcessInternalError(ctx context.Context, log logrus.FieldLogger, w http.ResponseWriter, ...)
- type RequestChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeRequest ¶
func DecodeRequest(w http.ResponseWriter, r *http.Request, log logrus.FieldLogger, req RequestChecker) (ok bool)
DecodeRequest decodes request and checks its validity. It process error if needed
func EncodeResponse ¶
func EncodeResponse(w http.ResponseWriter, r *http.Request, log logrus.FieldLogger, resp interface{}) (ok bool)
EncodeResponse encodes response. It process error if needed
func LogInternalError ¶
func LogInternalError(log logrus.FieldLogger, respMsg string, internalErr error)
func ProcessError ¶
ProcessError writes 'models.Response' with passed message and status code
func ProcessInternalError ¶ added in v0.5.0
func ProcessInternalError(ctx context.Context, log logrus.FieldLogger, w http.ResponseWriter, respMsg string, err error)
ProcessError logs internal error with 'LogInternalError' and calls 'ProcessError' with 'http.StatusInternalServerError' status code
Types ¶
type RequestChecker ¶
type RequestChecker interface {
Check() error
}
Click to show internal directories.
Click to hide internal directories.