Documentation ¶
Overview ¶
Fluent HTTP client for Golang. With timeout, retries and exponential back-off support.
Index ¶
- type Request
- func (f *Request) Body(b io.Reader) *Request
- func (f *Request) Delete(url string) *Request
- func (f *Request) Get(url string) *Request
- func (f *Request) InitialInterval(t time.Duration) *Request
- func (f *Request) Json(j interface{}) *Request
- func (f *Request) MaxElapsedTime(me time.Duration) *Request
- func (f *Request) MaxInterval(mi time.Duration) *Request
- func (f *Request) Method(method string) *Request
- func (f *Request) Multiplier(m float64) *Request
- func (f *Request) Patch(url string) *Request
- func (f *Request) Post(url string) *Request
- func (f *Request) Proxy(p string) *Request
- func (f *Request) Put(url string) *Request
- func (f *Request) RandomizationFactor(rf float64) *Request
- func (f *Request) Retry(r int) *Request
- func (f *Request) Send() (*http.Response, error)
- func (f *Request) SetHeader(key, value string) *Request
- func (f *Request) Timeout(t time.Duration) *Request
- func (f *Request) Url(url string) *Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) InitialInterval ¶
The initial interval for the request backoff operation.
the default is 500 * time.Millisecond
For more information http://godoc.org/github.com/cenkalti/backoff#ExponentialBackOff
func (*Request) Json ¶
A handy method for sending json without needing to Marshal it yourself This method will override whatever you pass to f.Body And it sets the content-type to "application/json"
func (*Request) MaxElapsedTime ¶
Set the Max Elapsed Time for the backoff.
The default is 15 * time.Minute.
For more information http://godoc.org/github.com/cenkalti/backoff#ExponentialBackOff
func (*Request) MaxInterval ¶
Set the Max Interval for the backoff.
The default is 60 * time.Second
For more information http://godoc.org/github.com/cenkalti/backoff#ExponentialBackOff
func (*Request) Method ¶
Set the request Method You probably want to use the methods [Post, Get, Patch, Delete, Put]
func (*Request) Multiplier ¶
Set the Multiplier for the backoff.
The default is 1.5.
For more information http://godoc.org/github.com/cenkalti/backoff#ExponentialBackOff
func (*Request) Post ¶
This is a shorthand method that calls f.Method with `POST` and calls f.Url with the url you give to her
func (*Request) RandomizationFactor ¶
Set the Randomization factor for the backoff.
the default is 0.5
For more information http://godoc.org/github.com/cenkalti/backoff#ExponentialBackOff
func (*Request) Retry ¶
Set how many times to retry if the request timedout or the server returned 5xx response.
func (*Request) Send ¶
It will construct the client and the request, then send it
This function has to be called as the last thing, after setting the other properties
func (*Request) SetHeader ¶
sets the header entries associated with key to the element value.
It replaces any existing values associated with key.
func (*Request) Timeout ¶
Timeout specifies a time limit for requests made by this Client. The timeout includes connection time, any redirects, and reading the response body. The timer remains running after Get, Head, Post, or Do return and will interrupt reading of the Response.Body.
A Timeout of zero means no timeout.