http

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 13 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 added in v0.1.0

func NewRequestHandlerHelper() internal.RequestHandlerHelper

Types

type BodyMock

type BodyMock struct {
	mock.Mock
}

func (*BodyMock) Close

func (b *BodyMock) Close() error

func (*BodyMock) Read

func (b *BodyMock) Read(p []byte) (n int, err error)

type Client

type Client interface {
	Do(req *native.Request, dst interface{}) error
}

func NewClient

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

type ClientMock

type ClientMock struct {
	mock.Mock
}

func (*ClientMock) Do

func (c *ClientMock) Do(req *http.Request, v interface{}) error

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
}

func (*NativeMock) Do

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

type RequestBroker added in v0.1.0

type RequestBroker interface {
	Go(ctx context.Context, v interface{}) error

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

	Domain(string) RequestBroker
	Path(string) RequestBroker
	Parameter(string, string) RequestBroker

	Header(string, string) RequestBroker
}

func NewRequest

func NewRequest(client Client) RequestBroker

type RequestHandler added in v0.1.0

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

func NewRequestHandler added in v0.1.0

func NewRequestHandler(helper internal.RequestHandlerHelper) RequestHandler

type RequestHandlerFunc added in v0.1.0

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

type RequestMock

type RequestMock struct {
	mock.Mock
}

func (*RequestMock) Delete

func (r *RequestMock) Delete() RequestBroker

func (*RequestMock) Domain

func (r *RequestMock) Domain(s string) RequestBroker

func (*RequestMock) Get

func (r *RequestMock) Get() RequestBroker

func (*RequestMock) Go

func (r *RequestMock) Go(ctx context.Context, v interface{}) error

func (*RequestMock) Header

func (r *RequestMock) Header(key, value string) RequestBroker

func (*RequestMock) Parameter

func (r *RequestMock) Parameter(key, value string) RequestBroker

func (*RequestMock) Path

func (r *RequestMock) Path(s string) RequestBroker

func (*RequestMock) Post

func (r *RequestMock) Post() RequestBroker

func (*RequestMock) Put

func (r *RequestMock) Put() RequestBroker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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