Documentation ¶
Index ¶
- func NoRedirect(req *http.Request, _ []*http.Request) error
- type BackoffStrategy
- type Client
- func (c *Client) Delete(urlStr string) (resp *http.Response, err error)
- func (c *Client) DeleteJSON(urlStr string, jsonStr string) (resp *http.Response, err error)
- func (c *Client) DeleteXML(urlStr string, xmlStr string) (resp *http.Response, err error)
- func (c *Client) Do(req *http.Request) (resp *http.Response, err error)
- func (c *Client) Get(urlStr string) (resp *http.Response, err error)
- func (c *Client) GetJSON(urlStr string) (resp *http.Response, err error)
- func (c *Client) GetXML(urlStr string) (resp *http.Response, err error)
- func (c *Client) Head(urlStr string) (resp *http.Response, err error)
- func (c *Client) Patch(urlStr string, bodyType string, body io.Reader) (resp *http.Response, err error)
- func (c *Client) PatchJSON(urlStr string, jsonStr string) (resp *http.Response, err error)
- func (c *Client) PatchXML(urlStr string, xmlStr string) (resp *http.Response, err error)
- func (c *Client) Post(urlStr string, bodyType string, body io.Reader) (resp *http.Response, err error)
- func (c *Client) PostForm(urlStr string, data url.Values) (resp *http.Response, err error)
- func (c *Client) PostJSON(urlStr string, jsonStr string) (resp *http.Response, err error)
- func (c *Client) PostXML(urlStr string, xmlStr string) (resp *http.Response, err error)
- func (c *Client) Put(urlStr string, bodyType string, body io.Reader) (resp *http.Response, err error)
- func (c *Client) PutJSON(urlStr, jsonStr string) (resp *http.Response, err error)
- func (c *Client) PutXML(urlStr, xmlStr string) (resp *http.Response, err error)
- func (c *Client) WithBackoff(backoff BackoffStrategy) *Client
- func (c *Client) WithCheckRedirect(checkFunc func(*http.Request, []*http.Request) error) *Client
- func (c *Client) WithCookieFile(file string) *Client
- func (c *Client) WithLogger(l Logger) *Client
- func (c *Client) WithPostCallback(callback PostRequestCallback) *Client
- func (c *Client) WithPreCallback(callback PreRequestCallback) *Client
- func (c *Client) WithRequestTrace(b bool) *Client
- func (c *Client) WithResponseTrace(b bool) *Client
- func (c *Client) WithRetries(retries int) *Client
- func (c *Client) WithTimeout(duration time.Duration) *Client
- func (c *Client) WithTrace(b bool) *Client
- func (c *Client) WithTransport(transport http.RoundTripper) *Client
- func (c *Client) WithoutCallbacks() *Client
- func (c *Client) WithoutPostCallbacks() *Client
- func (c *Client) WithoutPreCallbacks() *Client
- func (c *Client) WithoutRedirect() *Client
- type Logger
- type PostRequestCallback
- type PreRequestCallback
- type ReqBuilder
- func (b *ReqBuilder) Build() *http.Request
- func (b *ReqBuilder) WithAuth(username, password string) *ReqBuilder
- func (b *ReqBuilder) WithBody(body io.Reader) *ReqBuilder
- func (b *ReqBuilder) WithCompression() *ReqBuilder
- func (b *ReqBuilder) WithContentType(value string) *ReqBuilder
- func (b *ReqBuilder) WithHeader(name, value string) *ReqBuilder
- func (b *ReqBuilder) WithJSON(data string) *ReqBuilder
- func (b *ReqBuilder) WithMethod(method string) *ReqBuilder
- func (b *ReqBuilder) WithPostForm(data url.Values) *ReqBuilder
- func (b *ReqBuilder) WithUserAgent(value string) *ReqBuilder
- func (b *ReqBuilder) WithXML(data string) *ReqBuilder
- type SaveCookieError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BackoffStrategy ¶
type BackoffStrategy int
const ( CONSTANT_BACKOFF BackoffStrategy = iota LINEAR_BACKOFF BackoffStrategy = iota NO_BACKOFF BackoffStrategy = iota )
type Client ¶
func (*Client) DeleteJSON ¶
func (*Client) WithBackoff ¶
func (c *Client) WithBackoff(backoff BackoffStrategy) *Client
func (*Client) WithCheckRedirect ¶
func (*Client) WithCookieFile ¶
func (*Client) WithLogger ¶
func (*Client) WithPostCallback ¶
func (c *Client) WithPostCallback(callback PostRequestCallback) *Client
func (*Client) WithPreCallback ¶
func (c *Client) WithPreCallback(callback PreRequestCallback) *Client
func (*Client) WithRequestTrace ¶
func (*Client) WithResponseTrace ¶
func (*Client) WithRetries ¶
func (*Client) WithTransport ¶
func (c *Client) WithTransport(transport http.RoundTripper) *Client
func (*Client) WithoutCallbacks ¶
func (*Client) WithoutPostCallbacks ¶
func (*Client) WithoutPreCallbacks ¶
func (*Client) WithoutRedirect ¶
type Logger ¶
type Logger interface {
Printf(format string, args ...interface{})
}
var DefaultLogger Logger = &nullLogger{}
type PostRequestCallback ¶
type ReqBuilder ¶
type ReqBuilder struct {
// contains filtered or unexported fields
}
func RequestBuilder ¶
func RequestBuilder(u *url.URL) *ReqBuilder
func (*ReqBuilder) Build ¶
func (b *ReqBuilder) Build() *http.Request
func (*ReqBuilder) WithAuth ¶
func (b *ReqBuilder) WithAuth(username, password string) *ReqBuilder
func (*ReqBuilder) WithBody ¶
func (b *ReqBuilder) WithBody(body io.Reader) *ReqBuilder
func (*ReqBuilder) WithCompression ¶
func (b *ReqBuilder) WithCompression() *ReqBuilder
func (*ReqBuilder) WithContentType ¶
func (b *ReqBuilder) WithContentType(value string) *ReqBuilder
func (*ReqBuilder) WithHeader ¶
func (b *ReqBuilder) WithHeader(name, value string) *ReqBuilder
func (*ReqBuilder) WithJSON ¶
func (b *ReqBuilder) WithJSON(data string) *ReqBuilder
func (*ReqBuilder) WithMethod ¶
func (b *ReqBuilder) WithMethod(method string) *ReqBuilder
func (*ReqBuilder) WithPostForm ¶
func (b *ReqBuilder) WithPostForm(data url.Values) *ReqBuilder
func (*ReqBuilder) WithUserAgent ¶
func (b *ReqBuilder) WithUserAgent(value string) *ReqBuilder
func (*ReqBuilder) WithXML ¶
func (b *ReqBuilder) WithXML(data string) *ReqBuilder
type SaveCookieError ¶
type SaveCookieError struct {
// contains filtered or unexported fields
}
func (*SaveCookieError) Error ¶
func (e *SaveCookieError) Error() string
Click to show internal directories.
Click to hide internal directories.