Documentation ¶
Index ¶
- Constants
- func ContextRequest(ctx context.Context) *http.Request
- func EncodeError(w http.ResponseWriter, r *http.Request, err error)
- func WithRequest(ctx context.Context, req *http.Request) context.Context
- type DecodeRequestFunc
- type EncodeErrorFunc
- type EncodeResponseFunc
- type Error
- type HandleOption
- type HandleOptions
- type HandlerFunc
- type Interceptor
- type Router
- type RouterFunc
Constants ¶
View Source
const RequestContextKey = requestContextKey(0)
RequestContextKey .
View Source
const ( // SupportPackageIsVersion1 These constants should not be referenced from any other code. SupportPackageIsVersion1 = true )
Variables ¶
This section is empty.
Functions ¶
func EncodeError ¶
func EncodeError(w http.ResponseWriter, r *http.Request, err error)
EncodeError default EncodeErrorFunc implement
Types ¶
type DecodeRequestFunc ¶
DecodeRequestFunc is decode request func.
type EncodeErrorFunc ¶
type EncodeErrorFunc func(http.ResponseWriter, *http.Request, error)
EncodeErrorFunc is encode error func.
type EncodeResponseFunc ¶
type EncodeResponseFunc func(http.ResponseWriter, *http.Request, interface{}) error
EncodeResponseFunc is encode response func.
type HandleOption ¶
type HandleOption func(*HandleOptions)
HandleOption is handle option.
func WithHTTPInterceptor ¶
func WithHTTPInterceptor(i Interceptor) HandleOption
WithHTTPInterceptor .
func WithInterceptor ¶
func WithInterceptor(o interceptor.Interceptor) HandleOption
WithInterceptor .
type HandleOptions ¶
type HandleOptions struct { Decode DecodeRequestFunc Encode EncodeResponseFunc Error EncodeErrorFunc Interceptor interceptor.Interceptor HTTPInterceptor Interceptor }
HandleOptions is handle options.
type Interceptor ¶
type Interceptor func(h http.HandlerFunc) http.HandlerFunc
Interceptor is the func to intercept request or response
Click to show internal directories.
Click to hide internal directories.