client

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package client is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(req *http.Request) (*http.Response, error)

Do request with default client

func NewRequest

func NewRequest(ctx context.Context, method string, uri string,
	body []byte, headers http.Header) (*http.Request, error)

NewRequest create request

func NewStandardClient

func NewStandardClient(opts ...Option) *standardClient

func Send

func Send(ctx context.Context, method string, uri string,
	body []byte, headers http.Header) (*http.Response, error)

Send request with default client

Types

type Client

type Client interface {
	Do(req *http.Request) (*http.Response, error)
}
var DefaultClient Client = NewStandardClient()

type DefaultIP added in v1.2.0

type DefaultIP struct {
}

func (DefaultIP) Header added in v1.2.0

func (d DefaultIP) Header(ctx context.Context, srcHeader http.Header) http.Header

func (DefaultIP) URL added in v1.2.0

func (d DefaultIP) URL(ctx context.Context, path string) string

func (DefaultIP) URLWithQuery added in v1.2.0

func (d DefaultIP) URLWithQuery(ctx context.Context, path string, value url.Values) string

type MockClient

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

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) Do

func (m *MockClient) Do(req *http.Request) (*http.Response, error)

Do mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Do

func (mr *MockClientMockRecorder) Do(req interface{}) *gomock.Call

Do indicates an expected call of Do.

type Option

type Option func(*option)

func TLSConfig

func TLSConfig(cfg *tls.Config) Option

TLSConfig config tls

func Timeout

func Timeout(t time.Duration) Option

Timeout config timeout

type URLHandler added in v1.2.0

type URLHandler interface {
	URL(ctx context.Context, path string) string
	URLWithQuery(ctx context.Context, path string, value url.Values) string
	Header(ctx context.Context, header http.Header) http.Header
}

func NewURLHandler added in v1.2.0

func NewURLHandler() URLHandler

Jump to

Keyboard shortcuts

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