Documentation ¶
Index ¶
- Variables
- type Client
- type ClientOption
- func WithBaseUrl(baseURL string) ClientOption
- func WithCookieJar(jar http.CookieJar) ClientOption
- func WithCookies(cookies []*http.Cookie) ClientOption
- func WithHeader(key, value string) ClientOption
- func WithHeaders(header http.Header) ClientOption
- func WithHttpClient(hc *http.Client) ClientOption
- func WithTimeout(t time.Duration) ClientOption
- func WithTrace() ClientOption
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
var NewRequest = request.NewRequest
NewRequest is an alias for request.NewRequest
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Fetch ¶
Fetch sends an http.Request built from Request and returns a Response, containing the http.Response and the result of the request. The result can be a *string, a *[]byte or an io.Writer. If the result is nil, then result will be set as a *bytes.Buffer.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that modifies a Client
func WithBaseUrl ¶
func WithBaseUrl(baseURL string) ClientOption
WithBaseUrl sets the base url for the http.Client
func WithCookieJar ¶
func WithCookieJar(jar http.CookieJar) ClientOption
WithCookieJar sets the cookie jar for the http.Client Also CookieJar can be set with `WithHttpClient` option.
func WithCookies ¶
func WithCookies(cookies []*http.Cookie) ClientOption
WithCookies sets the cookies for the http.Client
func WithHeader ¶
func WithHeader(key, value string) ClientOption
WithHeader adds a key-value pair in the http.Header for the http.Client
func WithHeaders ¶
func WithHeaders(header http.Header) ClientOption
WithHeaders sets an http.Header for the http.Client
func WithHttpClient ¶
func WithHttpClient(hc *http.Client) ClientOption
WithHttpClient sets the http.Client to use
func WithTimeout ¶
func WithTimeout(t time.Duration) ClientOption
WithTimeout sets the timeout for the http.Client