http

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MethodPost    = http.MethodPost
	MethodGet     = http.MethodGet
	MethodPut     = http.MethodPut
	MethodDelete  = http.MethodDelete
	MethodOptions = http.MethodOptions
)

Variables

This section is empty.

Functions

func NewRequestHandlerHelper

func NewRequestHandlerHelper() internal.RequestHandlerHelper

Types

type BodyMock

type BodyMock struct {
	mock.Mock
}

BodyMock is an autogenerated mock type for the ReadCloser type

func NewBodyMock

func NewBodyMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *BodyMock

NewBodyMock creates a new instance of BodyMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*BodyMock) Close

func (_m *BodyMock) Close() error

Close provides a mock function with given fields:

func (*BodyMock) Read

func (_m *BodyMock) Read(p []byte) (int, error)

Read provides a mock function with given fields: p

type Client

type Client interface {
	DoAndUnmarshal(req *native.Request, v interface{}) error
	Do(req *native.Request) (io.Reader, error)
}

func NewClient

func NewClient(nativeClient Native, enc encoder.Factory) Client

type ClientMock

type ClientMock struct {
	mock.Mock
}

ClientMock is an autogenerated mock type for the Client type

func NewClientMock

func NewClientMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *ClientMock

NewClientMock creates a new instance of ClientMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*ClientMock) Do

func (_m *ClientMock) Do(req *nethttp.Request) (io.Reader, error)

Do provides a mock function with given fields: req

func (*ClientMock) DoAndUnmarshal

func (_m *ClientMock) DoAndUnmarshal(req *nethttp.Request, v interface{}) error

DoAndUnmarshal provides a mock function with given fields: req, v

type MethodType

type MethodType string

type Native

type Native interface {
	Do(req *native.Request) (*native.Response, error)
}

func NewNativeClient

func NewNativeClient() Native

type NativeMock

type NativeMock struct {
	mock.Mock
}

NativeMock is an autogenerated mock type for the Native type

func NewNativeMock

func NewNativeMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *NativeMock

NewNativeMock creates a new instance of NativeMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*NativeMock) Do

func (_m *NativeMock) Do(req *nethttp.Request) (*nethttp.Response, error)

Do provides a mock function with given fields: req

type RequestBroker

type RequestBroker interface {
	DoAndUnmarshal(ctx context.Context, v interface{}) error
	Do(ctx context.Context) (io.Reader, error)

	Post() RequestBroker
	Get() RequestBroker
	Put() RequestBroker
	Delete() RequestBroker

	URL(url string, v ...any) RequestBroker
	Query(key string, value string) RequestBroker
	Header(key string, value string) RequestBroker
	Body(body string) RequestBroker

	CreateRequest(ctx context.Context) (*native.Request, error)
}

func NewRequest

func NewRequest(client Client) RequestBroker

type RequestBrokerMock

type RequestBrokerMock struct {
	mock.Mock
}

RequestBrokerMock is an autogenerated mock type for the RequestBroker type

func NewRequestBrokerMock

func NewRequestBrokerMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *RequestBrokerMock

NewRequestBrokerMock creates a new instance of RequestBrokerMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*RequestBrokerMock) Body added in v2.0.1

func (_m *RequestBrokerMock) Body(body string) RequestBroker

Body provides a mock function with given fields: body

func (*RequestBrokerMock) CreateRequest added in v2.0.1

func (_m *RequestBrokerMock) CreateRequest(ctx context.Context) (*nethttp.Request, error)

CreateRequest provides a mock function with given fields: ctx

func (*RequestBrokerMock) Delete

func (_m *RequestBrokerMock) Delete() RequestBroker

Delete provides a mock function with given fields:

func (*RequestBrokerMock) Do added in v2.0.1

Do provides a mock function with given fields: ctx

func (*RequestBrokerMock) DoAndUnmarshal added in v2.0.1

func (_m *RequestBrokerMock) DoAndUnmarshal(ctx context.Context, v interface{}) error

DoAndUnmarshal provides a mock function with given fields: ctx, v

func (*RequestBrokerMock) Get

func (_m *RequestBrokerMock) Get() RequestBroker

Get provides a mock function with given fields:

func (*RequestBrokerMock) Header

func (_m *RequestBrokerMock) Header(key string, value string) RequestBroker

Header provides a mock function with given fields: key, value

func (*RequestBrokerMock) Post

func (_m *RequestBrokerMock) Post() RequestBroker

Post provides a mock function with given fields:

func (*RequestBrokerMock) Put

func (_m *RequestBrokerMock) Put() RequestBroker

Put provides a mock function with given fields:

func (*RequestBrokerMock) Query

func (_m *RequestBrokerMock) Query(key string, value string) RequestBroker

Query provides a mock function with given fields: key, value

func (*RequestBrokerMock) URL added in v2.0.1

func (_m *RequestBrokerMock) URL(url string, v ...interface{}) RequestBroker

URL provides a mock function with given fields: url, v

type RequestHandler

type RequestHandler interface {
	Handle(f RequestHandlerFunc) http.HandlerFunc
	MarshalAndVerify(r *http.Request, dst interface{}) error
}

func NewRequestHandler

func NewRequestHandler(helper internal.RequestHandlerHelper) RequestHandler

type RequestHandlerFunc

type RequestHandlerFunc func(ctx context.Context, r *http.Request) (interface{}, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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