Documentation ¶
Index ¶
- func DecorateDoerTransport(c *http.Client, ds ...TransportDecoratorFunc) *http.Client
- func DecorateDoerTransportByDefault(c *http.Client) *http.Client
- func DecorateTransport(rt http.RoundTripper, ds ...TransportDecoratorFunc) http.RoundTripper
- func DefaultDoer() *http.Client
- func DefaultTransport() *http.Transport
- type Doer
- type DoerDecoratorFunc
- type DoerFunc
- type DoerMock
- func (mmDo *DoerMock) Do(req *http.Request) (rp1 *http.Response, err error)
- func (mmDo *DoerMock) DoAfterCounter() uint64
- func (mmDo *DoerMock) DoBeforeCounter() uint64
- func (m *DoerMock) MinimockDoDone() bool
- func (m *DoerMock) MinimockDoInspect()
- func (m *DoerMock) MinimockFinish()
- func (m *DoerMock) MinimockWait(timeout mm_time.Duration)
- type DoerMockDoExpectation
- type DoerMockDoParams
- type DoerMockDoResults
- type DumpRequestFunc
- type DumpResponseFunc
- type LoggerFromRequestFunc
- type TransportDecoratorFunc
- type TransportFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecorateDoerTransport ¶
func DecorateDoerTransport(c *http.Client, ds ...TransportDecoratorFunc) *http.Client
DecorateDoerTransport decorates internal Transport of http.Client
func DecorateDoerTransportByDefault ¶
DecorateDoerTransportByDefault decorates a http.Client c with default set of decorators: 1. Error
func DecorateTransport ¶
func DecorateTransport(rt http.RoundTripper, ds ...TransportDecoratorFunc) http.RoundTripper
DecorateTransport decorates a http.RoundTripper c with all the given Decorators, in order.
func DefaultDoer ¶
DefaultDoer returns a new http.Client with similar default values to http.Client, but with a non-shared Transport. Intended to be reused for requests to the same host.
func DefaultTransport ¶
DefaultTransport returns a new http.Transport with similar default values to http.DefaultTransport. Intended to be reused for requests to the same host.
Types ¶
type Doer ¶
Doer is an interface supported by http.Client. Use this interface whenever you need to abstract from http.Client implementation and to use decorated client.
func DecorateDoer ¶
func DecorateDoer(c Doer, ds ...DoerDecoratorFunc) Doer
DecorateDoer decorates a Doer c with all the given Decorators, in order.
func DecorateDoerByDefault ¶
DecorateDoerByDefault decorates a Doer c with default set of decorators: 1. Error
type DoerDecoratorFunc ¶
DoerDecoratorFunc wraps a Doer with extra behaviour.
func ErrorDoerDecorator ¶
func ErrorDoerDecorator(serviceName string) DoerDecoratorFunc
ErrorDoerDecorator is a Doer decorator which wraps raised error with service name context.
type DoerMock ¶
type DoerMock struct { DoMock mDoerMockDo // contains filtered or unexported fields }
DoerMock implements Doer
func NewDoerMock ¶
func NewDoerMock(t minimock.Tester) *DoerMock
NewDoerMock returns a mock for Doer
func (*DoerMock) DoAfterCounter ¶
DoAfterCounter returns a count of finished DoerMock.Do invocations
func (*DoerMock) DoBeforeCounter ¶
DoBeforeCounter returns a count of DoerMock.Do invocations
func (*DoerMock) MinimockDoDone ¶
MinimockDoDone returns true if the count of the Do invocations corresponds the number of defined expectations
func (*DoerMock) MinimockDoInspect ¶
func (m *DoerMock) MinimockDoInspect()
MinimockDoInspect logs each unmet expectation
func (*DoerMock) MinimockFinish ¶
func (m *DoerMock) MinimockFinish()
MinimockFinish checks that all mocked methods have been called the expected number of times
func (*DoerMock) MinimockWait ¶
MinimockWait waits for all mocked methods to be called the expected number of times
type DoerMockDoExpectation ¶
type DoerMockDoExpectation struct { Counter uint64 // contains filtered or unexported fields }
DoerMockDoExpectation specifies expectation struct of the Doer.Do
type DoerMockDoParams ¶
type DoerMockDoParams struct {
// contains filtered or unexported fields
}
DoerMockDoParams contains parameters of the Doer.Do
type DoerMockDoResults ¶
type DoerMockDoResults struct {
// contains filtered or unexported fields
}
DoerMockDoResults contains results of the Doer.Do
type DumpRequestFunc ¶
DumpRequestFunc function to dump request. In most cases httputil.DumpRequestOut can be used
type DumpResponseFunc ¶
DumpResponseFunc function to dump response. In most cases httputil.DumpResponse can be used
type LoggerFromRequestFunc ¶
LoggerFromRequestFunc is a function to get logger from request/to enrich logger with context meta data.
type TransportDecoratorFunc ¶
type TransportDecoratorFunc func(http.RoundTripper) http.RoundTripper
TransportDecoratorFunc wraps a http.RoundTripper with extra behaviour.
func ErrorTransportDecorator ¶
func ErrorTransportDecorator() TransportDecoratorFunc
ErrorDoerDecorator is a net/http.Transport decorator which wraps raised error with requested host context.
func LoggerTransportDecorator ¶
func LoggerTransportDecorator(loggerFromRequestFn LoggerFromRequestFunc) TransportDecoratorFunc
LoggerTransportDecorator creates
func LoggerTransportDecoratorWithDumpers ¶
func LoggerTransportDecoratorWithDumpers( reqFn DumpRequestFunc, respFn DumpResponseFunc, loggerFromRequestFn LoggerFromRequestFunc, ) TransportDecoratorFunc
LoggerTransportDecoratorWithDumpers is a net/http.Transport decorator which logs response body to context`s logger
type TransportFunc ¶
TransportFunc is a function type that implements the http.RoundTripper interface.