Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
RequestUse(middlewares ...ClientRequestMiddleware)
ResponseUse(middlewares ...ClientResponseMiddleware)
Execute(ctx context.Context, request Request) (*Response, error)
}
type ClientMiddleware ¶
type ClientMiddleware interface {
ClientRequestMiddleware | ClientResponseMiddleware
}
type ClientRequestMiddleware ¶
type ClientRequestMiddleware func(ctx context.Context, r *Request, next MiddlewareNextFunc)
func InstrumentedRequestMiddleware ¶
func InstrumentedRequestMiddleware(name string) ClientRequestMiddleware
type ClientResponseMiddleware ¶
type ClientResponseMiddleware func(ctx context.Context, r *Response, next MiddlewareNextFunc)
type Headers ¶
func NewHeaders ¶
func NewHeaders() Headers
type MiddlewareNextFunc ¶
type Request ¶
type Request struct {
Headers Headers
Service string
Method string
Path string
Body []byte
ContentType string
}
func ApplyRequestMiddlewares ¶
func NewRequest ¶
func NewRequest(service, method, path string, opts ...RequestOption) (*Request, error)
type RequestOption ¶
func Body ¶
func Body(value []byte, contentType string) RequestOption
func Header ¶
func Header(key, value string) RequestOption
func JSONBody ¶
func JSONBody(value interface{}) RequestOption
func UrlEncodedBody ¶
func UrlEncodedBody(raw map[string]interface{}) RequestOption
Click to show internal directories.
Click to hide internal directories.