client

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MPL-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPC

type GRPC interface {
	Handle(context.Context, *api.Request) (*api.Response, map[string]string, error)
}

GRPC defines the interface for a GRPC client

func NewGRPC

func NewGRPC(uri string, timeout time.Duration) (GRPC, error)

NewGRPC creates a new GRPC client

type GRPCImpl

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

GRPCImpl is the concrete implementation of the GRPC client

func (*GRPCImpl) Handle

func (c *GRPCImpl) Handle(ctx context.Context, n *api.Request) (*api.Response, map[string]string, error)

Handle calls the upstream client

type HTTP

type HTTP interface {
	Do(r *http.Request, pr *http.Request) (int, []byte, map[string]string, map[string]string, error)
}

HTTP defines an interface for upstream HTTP client requests

func NewHTTP

func NewHTTP(upstreamClientKeepAlives bool, appendRequest bool, timeOut time.Duration, allowInsecure bool) HTTP

NewHTTP creates a new HTTP client

type HTTPImpl

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

HTTPImpl is the concrete implementation of the HTTP interface

func (*HTTPImpl) Do

func (h *HTTPImpl) Do(r *http.Request, pr *http.Request) (int, []byte, map[string]string, map[string]string, error)

Do makes the upstream request and returns a response

type MockGRPC

type MockGRPC struct {
	mock.Mock
}

MockGRPC is a mock implementation of the GRPC client

func (*MockGRPC) Handle

func (m *MockGRPC) Handle(ctx context.Context, n *api.Request) (*api.Response, map[string]string, error)

Handle calls the upstream client

type MockHTTP

type MockHTTP struct {
	mock.Mock
}

MockHTTP is a mock http client

func (*MockHTTP) Do

func (m *MockHTTP) Do(r, pr *http.Request) (int, []byte, map[string]string, map[string]string, error)

Do implements the HTTP interface method

Jump to

Keyboard shortcuts

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