Documentation ¶
Index ¶
- func CopyTo(resp *http.Response, dest io.Writer) (written int64, err error)
- func ReadAll(resp *http.Response) (b []byte, err error)
- func ReadJson(resp *http.Response, v any) (err error)
- func ReadString(resp *http.Response) (s string, err error)
- func SaveFile(resp *http.Response, name string) (written int64, err error)
- func WithContentType(contentType string) func(*RequestOptions)
- func WithDialTimeout(dialTimeout time.Duration) func(*ClientOptions)
- func WithExpectContinueTimeout(expectContinueTimeout time.Duration) func(*ClientOptions)
- func WithHeaders(headers http.Header) func(*RequestOptions)
- func WithIdleConnTimeout(idleConnTimeout time.Duration) func(*ClientOptions)
- func WithKeepAliveTimeout(keepAliveTimeout time.Duration) func(*ClientOptions)
- func WithMaxIdleConns(maxIdleConns int) func(*ClientOptions)
- func WithProxy(proxy string) func(*ClientOptions)
- func WithReferer(referer string) func(*RequestOptions)
- func WithTLSHandshakeTimeout(tlsHandshakeTimeout time.Duration) func(*ClientOptions)
- func WithTimeout(timeout time.Duration) func(*ClientOptions)
- func WithUserAgent(userAgent string) func(*ClientOptions)
- type Client
- func (c *Client) Close()
- func (c *Client) Get(url string, opts ...RequestOption) (resp *http.Response, err error)
- func (c *Client) Post(url string, contentType string, body io.Reader, opts ...RequestOption) (resp *http.Response, err error)
- func (c *Client) PostForm(url string, data url.Values, opts ...RequestOption) (resp *http.Response, err error)
- func (c *Client) PostJSON(url string, body any, opts ...RequestOption) (resp *http.Response, err error)
- type ClientOption
- type ClientOptions
- type RequestOption
- type RequestOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadString ¶
ReadString read string from resp.Body and close resp.Body
func WithContentType ¶
func WithContentType(contentType string) func(*RequestOptions)
func WithDialTimeout ¶
func WithDialTimeout(dialTimeout time.Duration) func(*ClientOptions)
func WithExpectContinueTimeout ¶
func WithExpectContinueTimeout(expectContinueTimeout time.Duration) func(*ClientOptions)
func WithHeaders ¶
func WithHeaders(headers http.Header) func(*RequestOptions)
func WithIdleConnTimeout ¶
func WithIdleConnTimeout(idleConnTimeout time.Duration) func(*ClientOptions)
func WithKeepAliveTimeout ¶
func WithKeepAliveTimeout(keepAliveTimeout time.Duration) func(*ClientOptions)
func WithMaxIdleConns ¶
func WithMaxIdleConns(maxIdleConns int) func(*ClientOptions)
func WithProxy ¶
func WithProxy(proxy string) func(*ClientOptions)
func WithReferer ¶
func WithReferer(referer string) func(*RequestOptions)
func WithTLSHandshakeTimeout ¶
func WithTLSHandshakeTimeout(tlsHandshakeTimeout time.Duration) func(*ClientOptions)
func WithTimeout ¶
func WithTimeout(timeout time.Duration) func(*ClientOptions)
func WithUserAgent ¶
func WithUserAgent(userAgent string) func(*ClientOptions)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type ClientOption ¶
type ClientOption func(*ClientOptions)
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
ClientOptions http client options
type RequestOption ¶
type RequestOption func(*RequestOptions)
type RequestOptions ¶
type RequestOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.