Versions in this module Expand all Collapse all v1 v1.0.4 Nov 27, 2017 Changes in this version + const DELETE + const FlagLogBody + const FlagLogDetail + const FlagLogOn + const GET + const HEAD + const OPTIONS + const PATCH + const POST + const PUT + var DefaultLogger = log.New(os.Stderr, "[zrequest]", 0) + var ErrRequestNotComp = errors.New("resp is nil, request not completed") + var FormBoundary = "FormBoundarykKyzkULVDem6riojjQMsLa2tgA" + var FormContentType = "application/x-www-form-urlencoded" + var HdrContentType = http.CanonicalHeaderKey("Content-Type") + var HdrUserAgent = http.CanonicalHeaderKey("User-Agent") + var JSONContentType = "application/json; charset=utf-8" + var MultipartContentType = "multipart/form-data; boundary=" + FormBoundary + var PlainTextType = "text/plain; charset=utf-8" + var StreamContentType = "application/octet-stream" + var TransportWithSSLSkipVerify = &http.Transport + func AnyToString(i interface{}) string + func IsTimeout(err interface{}) bool + type Decoder interface + Decode func(v interface{}) error + type Logger interface + Printf func(format string, v ...interface{}) + Println func(v ...interface{}) + type ZClient struct + func NewClient(timeout time.Duration, flags int, logger Logger) *ZClient + func NewClientWithHTTPClient(hc *http.Client, flags int, logger Logger) *ZClient + func NewClientWithSSLSkipVerify(timeout time.Duration, flags int, logger Logger) *ZClient + func NewClientWithTransport(timeout time.Duration, ts *http.Transport, flags int, logger Logger) *ZClient + func (c *ZClient) Open() *ZRequest + type ZRequest struct + BeforeHookFunc func(*ZRequest) error + func Open() *ZRequest + func (zr *ZRequest) Delete(urlStr string) *ZRequest + func (zr *ZRequest) DisableAtUpload() *ZRequest + func (zr *ZRequest) Do(method, urlStr string) *ZRequest + func (zr *ZRequest) Duration() time.Duration + func (zr *ZRequest) EnableAtUpload() *ZRequest + func (zr *ZRequest) Get(urlStr string) *ZRequest + func (zr *ZRequest) GetBodyBuf() io.Reader + func (zr *ZRequest) GetHeader() http.Header + func (zr *ZRequest) GetURLStr() string + func (zr *ZRequest) Head(urlStr string) *ZRequest + func (zr *ZRequest) Options(urlStr string) *ZRequest + func (zr *ZRequest) Patch(urlStr string) *ZRequest + func (zr *ZRequest) Post(urlStr string) *ZRequest + func (zr *ZRequest) Put(urlStr string) *ZRequest + func (zr *ZRequest) Resp() (*http.Response, error) + func (zr *ZRequest) RespBody() ([]byte, error) + func (zr *ZRequest) RespBodyN(n int64) ([]byte, error) + func (zr *ZRequest) RespBodyString() (string, error) + func (zr *ZRequest) RespBodyStringN(n int64) (string, error) + func (zr *ZRequest) RespCookies() []*http.Cookie + func (zr *ZRequest) RespHeader(key string) string + func (zr *ZRequest) RespHeaders() http.Header + func (zr *ZRequest) RespStatus() string + func (zr *ZRequest) RespStatusCode() int + func (zr *ZRequest) SetBasicAuth(username, password string) *ZRequest + func (zr *ZRequest) SetBody(body interface{}) *ZRequest + func (zr *ZRequest) SetBodyBuf(buf io.Reader) *ZRequest + func (zr *ZRequest) SetContentType(contentType string) *ZRequest + func (zr *ZRequest) SetCookie(ck *http.Cookie) *ZRequest + func (zr *ZRequest) SetCookieString(str string) *ZRequest + func (zr *ZRequest) SetCookies(cks []*http.Cookie) *ZRequest + func (zr *ZRequest) SetHeader(key, value string) *ZRequest + func (zr *ZRequest) SetHeaders(headers map[string]string) *ZRequest + func (zr *ZRequest) SetQueryParam(key, value string) *ZRequest + func (zr *ZRequest) SetQueryParamAny(key string, value interface{}) *ZRequest + func (zr *ZRequest) SetQueryParams(params map[string]string) *ZRequest + func (zr *ZRequest) SetQueryParamsAny(params map[string]interface{}) *ZRequest + func (zr *ZRequest) SetURLStr(urlStr string) *ZRequest + func (zr *ZRequest) SetUserAgent(ua string) *ZRequest + func (zr *ZRequest) Unmarshal(v interface{}) error