clients

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetMethod         = "GET"
	MaxRequestTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	//
	// SendRequest dispatches a receivedRequest based on the integration spec.
	//
	SendRequest() (*Response, error)

	//
	// SetClient change the internal http client.
	//
	SetClient(client ClientImpl)
}

func NewHttpRequest

func NewHttpRequest(
	spec *receivers.Spec,
	parameters map[string]string,
	envVars map[string]string,
	logger *log.Logger,
) (Client, error)

SendHttpRequest creates a *httpClient* with all required parameters to make a successful receivedRequest.

type ClientImpl

type ClientImpl interface {
	Do(req *http.Request) (*http.Response, error)
}

ClientImpl provides an interface for a specific implementation.

Added for convenience to create a mock implementation.

type Response

type Response struct {
	Code int
	Body string
	// contains filtered or unexported fields
}

Response represents the http code and body content.

func (*Response) IsOK

func (r *Response) IsOK() bool

IsOk returns true if status code matches one of the validCodes

Jump to

Keyboard shortcuts

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