Documentation
¶
Index ¶
- func CreateSimpleJSONBody(code, message string, errs ...error) []byte
- func DefaultErrorHandler(ctx Context, err error) api.StatusType
- func NewRequestHandler(ctx RequestContext) *requestHandler
- func NewRequestHandlerWithErrorHandler(ctx RequestContext, errHandler ErrorHandler) *requestHandler
- func NewResponseHandler(ctx ResponseContext) *responseHandler
- func NewResponseHandlerWithErrorHandler(ctx ResponseContext, errHandler ErrorHandler) *responseHandler
- func ToFlatHeader(header http.Header) map[string]string
- type Context
- type ErrorHandler
- type Header
- type LocalReplyOption
- type LocalReplyOptions
- type LogLevel
- type RequestContext
- type RequestHandler
- type RequestHandlerFunc
- type ResponseContext
- type ResponseHandler
- type ResponseHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSimpleJSONBody ¶
func DefaultErrorHandler ¶
func DefaultErrorHandler(ctx Context, err error) api.StatusType
func NewRequestHandler ¶
func NewRequestHandler(ctx RequestContext) *requestHandler
func NewRequestHandlerWithErrorHandler ¶
func NewRequestHandlerWithErrorHandler(ctx RequestContext, errHandler ErrorHandler) *requestHandler
func NewResponseHandler ¶
func NewResponseHandler(ctx ResponseContext) *responseHandler
func NewResponseHandlerWithErrorHandler ¶
func NewResponseHandlerWithErrorHandler(ctx ResponseContext, errHandler ErrorHandler) *responseHandler
Types ¶
type Context ¶
type Context interface {
Header
Log(lvl LogLevel, msg string)
JSON(statusCode int, body []byte, headers map[string]string, opts ...LocalReplyOption) error
PlainText(statusCode int, msg string, opts ...LocalReplyOption) error
StatusType() api.StatusType
}
type ErrorHandler ¶
type ErrorHandler func(Context, error) api.StatusType
type LocalReplyOption ¶
type LocalReplyOption func(o *LocalReplyOptions)
func WithGrpcStatus ¶
func WithGrpcStatus(status int64) LocalReplyOption
func WithLocalReplyDetail ¶
func WithLocalReplyDetail(detail string) LocalReplyOption
type LocalReplyOptions ¶
type LocalReplyOptions struct {
// contains filtered or unexported fields
}
func GetDefaultLocalReplyOptions ¶
func GetDefaultLocalReplyOptions() *LocalReplyOptions
type RequestContext ¶
func NewRequestContext ¶
func NewRequestContext(header api.RequestHeaderMap, callback api.FilterCallbacks) (RequestContext, error)
type RequestHandler ¶
type RequestHandler func(next RequestHandlerFunc) RequestHandlerFunc
type RequestHandlerFunc ¶
type RequestHandlerFunc func(ctx RequestContext, req *http.Request) error
type ResponseContext ¶
func NewResponseContext ¶
func NewResponseContext(header api.ResponseHeaderMap, callback api.FilterCallbacks) (ResponseContext, error)
type ResponseHandler ¶
type ResponseHandler func(next ResponseHandlerFunc) ResponseHandlerFunc
type ResponseHandlerFunc ¶
type ResponseHandlerFunc func(ctx ResponseContext, res *http.Response) error
Click to show internal directories.
Click to hide internal directories.