httpcommunicator

package
v0.0.0-...-a2e8c79 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPCommunicator

type HTTPCommunicator[I RequestOpts, O *RequestResponse] struct {
	// contains filtered or unexported fields
}

HTTPCommunicator client performs HTTP requests based on RequestOpts returned by adaptFn

func NewHTTPCommunicator

func NewHTTPCommunicator[I RequestOpts, O *RequestResponse](client *http.Client, logger *slog.Logger) *HTTPCommunicator[I, O]

func (*HTTPCommunicator[I, O]) Run

func (hc *HTTPCommunicator[I, O]) Run(_ context.Context, i I, ctx map[string]interface{}, _ string) (O, error)

type RequestOpts

type RequestOpts struct {
	// Only accept POST, GET, HEAD, POSTFORM
	Method      string
	URL         string
	ContentType string
	Body        io.Reader
	UrlValues   url.Values
}

RequestOpts contains all information needed to make the request

type RequestResponse

type RequestResponse struct {
	Status     string
	StatusCode int
	Body       io.ReadCloser
	Header     http.Header
}

Response from Request. Call Close() on Body is next worker responsability

Jump to

Keyboard shortcuts

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