Documentation ¶
Index ¶
- func OptSetCloseChan(c <-chan struct{}) func(*Type)
- func OptSetLogger(log log.Modular) func(*Type)
- func OptSetStats(stats metrics.Type) func(*Type)
- type Config
- type Type
- func (h *Type) CreateRequest(msg types.Message) (req *http.Request, err error)
- func (h *Type) CreateRequestWithURL(url string, msg types.Message) (req *http.Request, err error)
- func (h *Type) Do(msg types.Message) (res *http.Response, err error)
- func (h *Type) DoWithURL(url string, msg types.Message) (res *http.Response, err error)
- func (h *Type) ParseResponse(res *http.Response) (resMsg types.Message, err error)
- func (h *Type) Send(msg types.Message) (types.Message, error)
- func (h *Type) SendWithURL(url string, msg types.Message) (types.Message, error)
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.
func OptSetLogger ¶ added in v0.16.2
OptSetLogger sets the logger to use.
func OptSetStats ¶ added in v0.16.2
OptSetStats sets the metrics aggregator to use.
Types ¶
type Config ¶
type Config struct { URL string `json:"url" yaml:"url"` Verb string `json:"verb" yaml:"verb"` Headers map[string]string `json:"headers" yaml:"headers"` 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.
type Type ¶
type Type struct { URL string // contains filtered or unexported fields }
Type is an output type that pushes messages to Type.
func (*Type) CreateRequest ¶ added in v0.16.0
CreateRequest creates an HTTP request out of a single message.
func (*Type) CreateRequestWithURL ¶ added in v0.16.2
CreateRequestWithURL creates an HTTP request out of a single message.
func (*Type) Do ¶ added in v0.16.0
Do attempts to create and perform an HTTP request from a message payload. This attempt may include retries, and if all retries fail an error is returned.
func (*Type) DoWithURL ¶ added in v0.16.2
DoWithURL attempts to create and perform an HTTP request from a message payload. This attempt may include retries, and if all retries fail an error is returned.
func (*Type) ParseResponse ¶ added in v0.16.0
ParseResponse attempts to parse an HTTP response into a 2D slice of bytes.
func (*Type) Send ¶
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.
func (*Type) SendWithURL ¶ added in v0.16.2
SendWithURL attempts to send a message to an HTTP server with a specific URL, 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.