client

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetadataWithMocker

func MetadataWithMocker(mocker *Mocker) courier.Metadata

func NewInsecureTLSTransport

func NewInsecureTLSTransport(rootCA []byte) transport_http.TransportWrapper

Types

type Client

type Client struct {
	Name string
	// used in service
	Service       string
	Version       string
	Host          string `conf:"upstream" validate:"@hostname"`
	Mode          string
	Port          int16
	Timeout       time.Duration
	WrapTransport transport_http.TransportWrapper `json:"-"`
}

func (Client) GetBaseURL

func (c Client) GetBaseURL(protocol string) (url string)

func (Client) MarshalDefaults

func (Client) MarshalDefaults(v interface{})

func (*Client) Request

func (c *Client) Request(id, httpMethod, uri string, req interface{}, metas ...courier.Metadata) IRequest

type IRequest

type IRequest interface {
	Do() courier.Result
}

type MockData

type MockData struct {
	Data  []byte           `json:"data,omitempty"`
	Error []byte           `json:"error,omitempty"`
	Meta  courier.Metadata `json:"metadata,omitempty"`
}

func (*MockData) String

func (data *MockData) String() string

type MockRequest

type MockRequest struct {
	*MockData
	courier.Result
}

func (*MockRequest) Do

func (mock *MockRequest) Do() courier.Result

type Mocker

type Mocker struct {
	Service string
	Mocks   map[string]*MockData
}

func Mock

func Mock(service string) *Mocker

func ParseMockID

func ParseMockID(service string, requestID string) (mock *Mocker, err error)

func (Mocker) For

func (mocker Mocker) For(methodID string, m *MockData) *Mocker

func (Mocker) From

func (mocker Mocker) From(mock string) (*Mocker, error)

func (*Mocker) RequestID

func (mocker *Mocker) RequestID() string

Jump to

Keyboard shortcuts

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