Documentation ¶
Index ¶
- func OptSetLogger(log log.Modular) func(*Client)
- func OptSetManager(mgr types.Manager) func(*Client)
- func OptSetRoundTripper(rt http.RoundTripper) func(*Client)
- func OptSetStats(stats metrics.Type) func(*Client)
- type Client
- func (h *Client) Close(ctx context.Context) error
- func (h *Client) CreateRequest(sendMsg, refMsg types.Message) (req *http.Request, err error)
- func (h *Client) ParseResponse(res *http.Response) (resMsg types.Message, err error)
- func (h *Client) Send(ctx context.Context, sendMsg, refMsg types.Message) (types.Message, error)
- func (h *Client) SendToResponse(ctx context.Context, sendMsg, refMsg types.Message) (res *http.Response, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptSetLogger ¶
OptSetLogger sets the logger to use.
func OptSetManager ¶
OptSetManager sets the manager to use.
func OptSetRoundTripper ¶
func OptSetRoundTripper(rt http.RoundTripper) func(*Client)
OptSetRoundTripper sets the *client.Transport to use for HTTP requests. NOTE: This setting will override any configured TLS options.
func OptSetStats ¶
OptSetStats sets the metrics aggregator to use.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a component able to send and receive Benthos messages over HTTP.
func (*Client) CreateRequest ¶
CreateRequest forms an *http.Request from a message to be sent as the body, and also a message used to form headers (they can be the same).
func (*Client) ParseResponse ¶
ParseResponse attempts to parse an HTTP response into a 2D slice of bytes.
func (*Client) Send ¶
Send creates an HTTP request from the client config, a provided message to be sent as the body of the request, and a reference message used to establish interpolated fields for the request (which can be the same as the message used for the body).
If the request is successful then the response is parsed into a message, including headers added as metadata (when configured to do so).
func (*Client) SendToResponse ¶
func (h *Client) SendToResponse(ctx context.Context, sendMsg, refMsg types.Message) (res *http.Response, err error)
SendToResponse attempts to create an HTTP request from a provided message, performs it, and then returns the *http.Response, allowing the raw response to be consumed.