client

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptSetCloseChan

func OptSetCloseChan(c <-chan struct{}) func(*Type)

OptSetCloseChan sets a channel that when closed will interrupt any blocking calls within the client.

Types

type Config

type Config struct {
	URL            string `json:"url" yaml:"url"`
	Verb           string `json:"verb" yaml:"verb"`
	ContentType    string `json:"content_type" yaml:"content_type"`
	TimeoutMS      int64  `json:"timeout_ms" yaml:"timeout_ms"`
	RetryMS        int64  `json:"retry_period_ms" yaml:"retry_period_ms"`
	MaxBackoffMS   int64  `json:"max_retry_backoff_ms" yaml:"max_retry_backoff_ms"`
	NumRetries     int    `json:"retries" yaml:"retries"`
	BackoffOn      []int  `json:"backoff_on" yaml:"backoff_on"`
	DropOn         []int  `json:"drop_on" yaml:"drop_on"`
	SkipCertVerify bool   `json:"skip_cert_verify" yaml:"skip_cert_verify"`
	auth.Config    `json:",inline" yaml:",inline"`
}

Config is a configuration struct for an HTTP client.

func NewConfig

func NewConfig() Config

NewConfig creates a new Config with default values.

type Type

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

Type is an output type that pushes messages to Type.

func New

func New(conf Config, opts ...func(*Type)) *Type

New creates a new Type.

func (*Type) Send

func (h *Type) Send(msg types.Message) (types.Message, error)

Send attempts to send a message to an HTTP server, this attempt may include retries, and if all retries fail an error is returned. The message payload can be nil, in which case an empty body is sent. The response will be parsed back into a message, meaning mulitpart content handling is done for you.

If the response body is empty the message returned is nil.

Jump to

Keyboard shortcuts

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