Documentation ¶
Index ¶
- func GetURLResponse(url string, trim bool) (string, error)
- type Agent
- func (a *Agent) Client() *http.Client
- func (a *Agent) Get(url string) (content []byte, err error)
- func (a *Agent) GetRequest(url string) (response *http.Response, err error)
- func (a *Agent) Post(url string, postData []byte) (content []byte, err error)
- func (a *Agent) PostRequest(url string, postData []byte) (response *http.Response, err error)
- func (a *Agent) SetImplementation(impl AgentImplementation)
- func (a *Agent) WithFailOnHTTPError(flag bool) *Agent
- func (a *Agent) WithRetries(retries uint) *Agent
- func (a *Agent) WithTimeout(timeout time.Duration) *Agent
- type AgentImplementation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Agent ¶ added in v0.2.0
type Agent struct { AgentImplementation // contains filtered or unexported fields }
Agent is an http agent
func NewAgent ¶ added in v0.2.0
func NewAgent() *Agent
NewAgent return a new agent with default options
func (*Agent) Client ¶ added in v0.2.0
Client return an net/http client preconfigured with the agent options
func (*Agent) GetRequest ¶ added in v0.2.0
GetRequest sends a GET request to a URL and returns the request and response
func (*Agent) PostRequest ¶ added in v0.2.0
PostRequest sends the postData in a POST request to a URL and returns the request object
func (*Agent) SetImplementation ¶ added in v0.2.0
func (a *Agent) SetImplementation(impl AgentImplementation)
SetImplementation sets the agent implementation
func (*Agent) WithFailOnHTTPError ¶ added in v0.2.0
WithFailOnHTTPError determines if the agent fails on HTTP errors (HTTP status not in 200s)
func (*Agent) WithRetries ¶ added in v0.2.0
WithRetries sets the number of times we'll attempt to fetch the URL
Click to show internal directories.
Click to hide internal directories.