Versions in this module Expand all Collapse all v0 v0.0.1 Mar 10, 2023 Changes in this version + const DefaultMaxBodySize + const DefaultRetryTimes + const DefaultTimeout + var DefaultHeaders = map[string]string + var DefaultRetryHTTPCodes = []int + var ErrRequestCancel = errors.New("request canceled") + func AddRoundRobinProxy(u string, proxyURLs ...string) + func DefaultTemplateFuncMap() template.FuncMap + func RoundRobinProxy(req *http.Request) (*url.URL, error) + type Fetch interface + DoRequest func(*Request) (*Response, error) + Get func(url string, headers map[string]string) (*Response, error) + Head func(url string, headers map[string]string) (*Response, error) + Post func(url string, body any, headers map[string]string) (*Response, error) + Request func(method, url string, body any, headers map[string]string) (*Response, error) + func NewFetcher(opt Options) Fetch + type Options struct + CachePolicy cache.Policy + CharsetDetectDisabled bool + MaxBodySize int64 + ProxyFunc func(*http.Request) (*url.URL, error) + RetryHTTPCodes []int + RetryTimes int + Timeout time.Duration + type Request struct + Cancelled bool + Encoding string + Proxy []string + func NewRequest(method, u string, body any, headers map[string]string) (*Request, error) + func NewTemplateRequest(funcs template.FuncMap, tpl string, arg any) (*Request, error) + func (r *Request) Cancel() + func (r *Request) WithContext(ctx context.Context) *Request + type Response struct + Body []byte + func (r *Response) ContentType() string + func (r *Response) String() string Other modules containing this package github.com/shiroyk/cloudcat/fetch