Documentation ¶
Index ¶
- type CallOption
- type Caller
- type DoFunc
- type Factory
- type Handler
- type HandlerOption
- func WithAllowEncoding(allowEncoding bool) HandlerOption
- func WithMaxRequestBodySize(maxRequestBodySize int64) HandlerOption
- func WithMiddleware(middleware ...MiddlewareFunc) HandlerOption
- func WithOnError(onError func(error, *http.Request)) HandlerOption
- func WithRequestTimeout(requestTimeout time.Duration) HandlerOption
- func WithResponseTimeout(responseTimeout time.Duration) HandlerOption
- type HeaderOption
- type HeaderOptionKeyVal
- type InvalidContentTypeError
- type MiddlewareFunc
- type Registrar
- type Request
- type RequestError
- type Response
- type SendFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOption ¶ added in v0.8.0
type CallOption interface {
// contains filtered or unexported methods
}
func WithAdditionalRequestHeader ¶ added in v0.2.0
func WithAdditionalRequestHeader(header ...http.Header) CallOption
func WithErrOut ¶ added in v0.3.0
func WithErrOut(errOut error) CallOption
func WithForceBody ¶ added in v0.5.0
func WithForceBody(forceBody bool) CallOption
func WithMaxResponseBodySize ¶ added in v0.2.0
func WithMaxResponseBodySize(maxResponseBodySize int64) CallOption
func WithRequestHeader ¶ added in v0.2.0
func WithRequestHeader(header ...http.Header) CallOption
type Caller ¶
type Caller struct {
// contains filtered or unexported fields
}
Caller is the HTTP requester to do JSON requests with the given method to the given endpoint. The method and endpoint are given from Factory.
type Factory ¶ added in v0.2.0
type Factory struct {
// contains filtered or unexported fields
}
Factory is Caller factory to create new Caller's.
func NewFactory ¶ added in v0.2.0
NewFactory creates a new Factory.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements http.Handler to process JSON requests based on pattern and registered methods. Handler is similar to http.ServeMux in terms of operation.
func NewHandler ¶
func NewHandler(opts ...HandlerOption) (h *Handler)
NewHandler creates a new Handler by given HandlerOption's.
type HandlerOption ¶
type HandlerOption interface {
// contains filtered or unexported methods
}
func WithAllowEncoding ¶ added in v0.2.0
func WithAllowEncoding(allowEncoding bool) HandlerOption
func WithMaxRequestBodySize ¶
func WithMaxRequestBodySize(maxRequestBodySize int64) HandlerOption
func WithMiddleware ¶
func WithMiddleware(middleware ...MiddlewareFunc) HandlerOption
func WithOnError ¶
func WithOnError(onError func(error, *http.Request)) HandlerOption
func WithRequestTimeout ¶ added in v0.2.0
func WithRequestTimeout(requestTimeout time.Duration) HandlerOption
func WithResponseTimeout ¶ added in v0.5.0
func WithResponseTimeout(responseTimeout time.Duration) HandlerOption
type HeaderOption ¶ added in v0.2.0
type HeaderOption struct { KeyVals []HeaderOptionKeyVal Map map[string]string }
func ParseHeaderOptions ¶ added in v0.2.0
func ParseHeaderOptions(directive string) (options []HeaderOption)
type HeaderOptionKeyVal ¶ added in v0.2.0
type InvalidContentTypeError ¶ added in v0.6.0
type InvalidContentTypeError struct {
// contains filtered or unexported fields
}
func (*InvalidContentTypeError) ContentType ¶ added in v0.6.0
func (e *InvalidContentTypeError) ContentType() string
func (*InvalidContentTypeError) Error ¶ added in v0.6.0
func (e *InvalidContentTypeError) Error() string
type MiddlewareFunc ¶ added in v0.2.0
type Registrar ¶ added in v0.8.0
type Registrar interface {
Register(method string, in interface{}, do DoFunc, opts ...HandlerOption) Registrar
}
Registrar is method registrar and created by Handler.
type RequestError ¶ added in v0.6.0
type RequestError struct {
// contains filtered or unexported fields
}
func (*RequestError) Error ¶ added in v0.6.0
func (e *RequestError) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.