Versions in this module Expand all Collapse all v1 v1.0.1 May 14, 2021 Changes in this version + var Debug = false + var DefaultClient = NewClient() + var ReqRejectedErr = errors.New("request is rejected") + func GetRequestHash(r *Request) string + func ModifyLink(url string) string + type Client struct + Client *http.Client + func NewClient(m ...Middleware) *Client + func (s *Client) Do(req *Request) *Response + func (s *Client) Use(mid ...Middleware) *Client + type DelayLimiterOpinion struct + Delay time.Duration + RandomDelay time.Duration + type FilterLimiterOpinion struct + Allow bool + type FormField struct + Name string + Value string + type FormFile struct + ContentType string + FieldName string + File io.Reader + FileName string + type Handler func(*Request) *Response + type LimitRuleAllow uint8 + const Allow + const Disallow + const NotSet + type LimiterMatcher struct + Glob string + Regexp string + func (s *LimiterMatcher) Compile() + func (s *LimiterMatcher) Match(u *url.URL) bool + type Middleware func(*Client, Handler) Handler + func WithCache(ca *cache.Cache) Middleware + func WithCookie(urlAddr string, cookies ...*http.Cookie) Middleware + func WithDebug() Middleware + func WithDelayLimiter(eachSite bool, opts ...*DelayLimiterOpinion) Middleware + func WithFilterLimiter(noneMatchAllow bool, opts ...*FilterLimiterOpinion) Middleware + func WithParallelismLimiter(eachSite bool, opts ...*ParallelismLimiterOpinion) Middleware + func WithProxy(p ...string) Middleware + func WithRandomUA() Middleware + func WithRateLimiter(eachSite bool, opts ...*RateLimiterOpinion) Middleware + func WithRefererFiller() Middleware + func WithRetry(maxTimes int, isRespOk func(*Response) bool) Middleware + type ParallelismLimiterOpinion struct + Parallelism int64 + type RateLimiterOpinion struct + Rate int64 + type Request struct + Debug bool + Err error + RespEncode string + Writer io.Writer + func Connect(urladdr string) *Request + func Delete(urladdr string) *Request + func Get(urladdr string) *Request + func Head(urladdr string) *Request + func NewRequest(method, urladdr string) *Request + func Options(urladdr string) *Request + func Patch(urladdr string) *Request + func Post(urladdr string) *Request + func Put(urladdr string) *Request + func Trace(urladdr string) *Request + func (s *Request) AddCookie(c *http.Cookie) *Request + func (s *Request) AddCookies(cs ...*http.Cookie) *Request + func (s *Request) AddHeader(key, value string) *Request + func (s *Request) AddHeaders(v map[string]string) *Request + func (s *Request) AddParam(k, v string) *Request + func (s *Request) AddParams(v map[string]string) *Request + func (s *Request) DisableRedirect() *Request + func (s *Request) Do() *Response + func (s *Request) NoCache() *Request + func (s *Request) SetBasicAuth(username, password string) *Request + func (s *Request) SetBody(b io.Reader) *Request + func (s *Request) SetCacheExpiration(e time.Duration) *Request + func (s *Request) SetCallback(fn func(resp *Response) *Response) *Request + func (s *Request) SetCheckRedirect(fn func(req *http.Request, via []*http.Request) error) *Request + func (s *Request) SetClient(c *Client) *Request + func (s *Request) SetDebug(d bool) *Request + func (s *Request) SetFormBody(v map[string]string) *Request + func (s *Request) SetJsonBody(v interface{}) *Request + func (s *Request) SetMultipartBody(data ...interface{}) *Request + func (s *Request) SetProxy(urladdr string) *Request + func (s *Request) SetRawBody(b []byte) *Request + func (s *Request) SetTimeout(t time.Duration) *Request + func (s *Request) SetUA(ua string) *Request + func (s *Request) String() string + type RequestError struct + type Response struct + Body []byte + CacheHash string + Err error + NotDecodedBody []byte + Req *Request + Text string + func Do(req *Request) *Response + func (s *Response) BindJSON(i interface{}) error + func (s *Response) BindXML(i interface{}) error + func (s *Response) DecodeAndParse() error + func (s *Response) Error() error + func (s *Response) HTML() (*goquery.Document, error) + func (s *Response) IsHTML() bool + func (s *Response) IsJSON() bool + func (s *Response) JSON() (gjson.Result, error) + func (s *Response) Resp() (*Response, error) + func (s *Response) RespAndHTML() (*Response, *goquery.Document, error) + func (s *Response) RespAndJSON() (*Response, gjson.Result, error) + func (s *Response) RespAndTxt() (*Response, string, error) + func (s *Response) RespAndXML() (*Response, *xmlpath.Node, error) + func (s *Response) Txt() (string, error) + func (s *Response) XML() (*xmlpath.Node, error)