Documentation ¶
Index ¶
Constants ¶
const DefaultMaxRequestSize = 2 << 20 // 2MB
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is implementation of status error.
func NewBadRequestError ¶
NewBadRequestError creates a new bad request rest error.
func NewNotFoundError ¶
NewNotFoundError creates a new not found rest error.
func NewRestError ¶
NewRestError creates an error returned to user with provided status user displayed message and internal error
func (*Error) UserMessage ¶
type HttpHandler ¶
HttpHandler is custom http handler implementing custom handler function. HttpHandler function allows easier handling of errors and responses as it wraps functionality for handling error and responses outside of endpoint handling.
func NewHttpHandler ¶
func (*HttpHandler) ErrorHandler ¶
func (h *HttpHandler) ErrorHandler(w http.ResponseWriter, err error, errorLogger zerolog.Logger)
func (*HttpHandler) JsonResponse ¶
func (h *HttpHandler) JsonResponse(w http.ResponseWriter, code int, response interface{}, errLogger zerolog.Logger)
JsonResponse builds a JSON response and send it to the client
func (*HttpHandler) VerifyRequest ¶
func (h *HttpHandler) VerifyRequest(w http.ResponseWriter, r *http.Request) error
VerifyRequest function acts as a wrapper to each request providing common handling functionality such as logging, error handling
type Request ¶
type Request struct { *http.Request ExpandFields map[string]bool Chain flow.Chain // contains filtered or unexported fields }
Request a convenience wrapper around the http request to make it easy to read request query params
func Decorate ¶
Decorate takes http request and applies functions to produce our custom request object decorated with values we need
func (*Request) GetQueryParam ¶
func (*Request) GetQueryParams ¶
type StatusError ¶
type StatusError interface { error // this is the actual error that occured Status() int // the HTTP status code to return UserMessage() string // the error message to return to the client }
StatusError provides custom error with http status.
Directories ¶
Path | Synopsis |
---|---|
* Access API * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
* Access API * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) |