http

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMonitorProxy

func NewMonitorProxy(options ...MonitorProxyOption) *monitorProxy

func NewSlowProxy

func NewSlowProxy(logger log.Logger, name string) *slowProxy

func NewSpyProxy

func NewSpyProxy(logger log.Logger, name string) *spyProxy

func NewStubsProxy

func NewStubsProxy(options ...StubsProxyOption) *stubsProxy

Types

type ClientOptions

type ClientOptions struct{}

func (ClientOptions) WithLogger

func (ClientOptions) WithLogger(logger log.Logger) Option

func (ClientOptions) WithProxy

func (ClientOptions) WithProxy(proxy ...func() interface{}) Option

func (ClientOptions) WithTimeOut

func (ClientOptions) WithTimeOut(timeout time.Duration) Option

type HttpClient

type HttpClient struct {
	// contains filtered or unexported fields
}

func NewHttpClient

func NewHttpClient(options ...Option) *HttpClient

func (*HttpClient) CloseIdleConnections

func (this *HttpClient) CloseIdleConnections(ctx context.Context)

func (*HttpClient) Do

func (this *HttpClient) Do(ctx context.Context, req *http.Request) (*http.Response, error)

func (*HttpClient) Get

func (this *HttpClient) Get(ctx context.Context, url string) (resp *http.Response, err error)

func (*HttpClient) Head

func (this *HttpClient) Head(ctx context.Context, url string) (resp *http.Response, err error)

func (*HttpClient) Post

func (this *HttpClient) Post(ctx context.Context, url, contentType string, body io.Reader) (resp *http.Response, err error)

func (*HttpClient) PostForm

func (this *HttpClient) PostForm(ctx context.Context, url string, data url.Values) (resp *http.Response, err error)

type MonitorProxyOption

type MonitorProxyOption func(c *monitorProxy)

type MonitorProxyOptions

type MonitorProxyOptions struct{}

func (MonitorProxyOptions) WithConf

func (MonitorProxyOptions) WithLogger

func (MonitorProxyOptions) WithLogger(logger log.Logger) MonitorProxyOption

func (MonitorProxyOptions) WithTracer

use nethttp.Tracer

type Option

type Option func(c *HttpClient)

type StubsProxyOption

type StubsProxyOption func(c *stubsProxy)

type StubsProxyOptions

type StubsProxyOptions struct{}

func (StubsProxyOptions) WithLogger

func (StubsProxyOptions) WithLogger(logger log.Logger) StubsProxyOption

func (StubsProxyOptions) WithName

func (StubsProxyOptions) WithName(name string) StubsProxyOption

func (StubsProxyOptions) WithRespFunc

func (StubsProxyOptions) WithRespFunc(respFunc func(*http.Request) *http.Response) StubsProxyOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL