Versions in this module Expand all Collapse all v0 v0.0.2 Sep 25, 2019 v0.0.1 Sep 25, 2019 Changes in this version + const DELETE + const GET + const HEAD + const OPTIONS + const PATCH + const POST + const PUT + const TypeApplicationForm + const TypeApplicationJson + const TypeApplicationStream + const TypeApplicationXml + const TypeMultipartFormData + const TypeTextHtml + const TypeTextPlain + var DefaultContext = NewContext() + var ErrReqBodyType = errors.New("invalid request body type") + var ErrRespOutType = errors.New("invalid response output type") + var GlobalReqBodyMediaReaders = map[string]ReqBodyReader + var GlobalReqBodyTypeReaders = map[reflect.Type]ReqBodyReader + var GlobalRespBodyMediaReaders = map[string]RespBodyReader + var GlobalRespBodyTypeReaders = map[reflect.Type]RespBodyReader + type BodyReaders struct + ReqBodyMediaReaders map[string]ReqBodyReader + ReqBodyTypeReaders map[reflect.Type]ReqBodyReader + RespBodyMediaReaders map[string]RespBodyReader + RespBodyTypeReaders map[reflect.Type]RespBodyReader + func NewBodyReaders() *BodyReaders + type Callback func(c *HttpC, args ...interface{}) error + type Context struct + BodyReaders *BodyReaders + CbAfterSend []Callback + CbBeforeSend []Callback + CbOnError []Callback + CbOnRetring []Callback + Client *http.Client + Retries int + RetryFactor float64 + RetryInterval time.Duration + func NewContext() *Context + func (c *Context) AddCbAfterSend(cb Callback) *Context + func (c *Context) AddCbBeforeSend(cb Callback) *Context + func (c *Context) AddCbOnError(cb Callback) *Context + func (c *Context) AddCbOnRetring(cb Callback) *Context + func (c *Context) EnableCookie(enable bool) *Context + func (c *Context) SetCheckRedirect(cr func(req *http.Request, via []*http.Request) error) *Context + func (c *Context) SetClient(client *http.Client) *Context + func (c *Context) SetConnectReadTimeout(connectTimeout time.Duration, readTimeout time.Duration) *Context + func (c *Context) SetProxy(proxy func(*http.Request) (*url.URL, error)) *Context + func (c *Context) SetRetryConfig(retries int, interval time.Duration, factor float64) *Context + func (c *Context) SetTLSClientConfig(config *tls.Config) *Context + func (c *Context) SetTotalTimeout(timeout time.Duration) *Context + type FilePath string + type HttpC struct + BaseURL string + Context *Context + Data interface{} + Error error + QueryData url.Values + Request *http.Request + Response *http.Response + SendMediaType string + SucStatus int + URL string + func New(baseUrl string) *HttpC + func (c *HttpC) AddCookie(ck *http.Cookie) *HttpC + func (c *HttpC) AddHeader(key, value string) *HttpC + func (c *HttpC) BasicAuth(userName, password string) *HttpC + func (c *HttpC) Body(body interface{}, mediaType ...string) *HttpC + func (c *HttpC) ContentType(value string) *HttpC + func (c *HttpC) Delete(out interface{}, mediaType ...string) error + func (c *HttpC) DumpRequest(dumpBody ...bool) string + func (c *HttpC) DumpResponse(dumpBody ...bool) string + func (c *HttpC) EscapedPath(path interface{}) *HttpC + func (c *HttpC) Get(out interface{}, mediaType ...string) error + func (c *HttpC) Header(key, value string) *HttpC + func (c *HttpC) Options(out interface{}, mediaType ...string) error + func (c *HttpC) Patch(out interface{}, mediaType ...string) error + func (c *HttpC) Path(path string) *HttpC + func (c *HttpC) Post(out interface{}, mediaType ...string) error + func (c *HttpC) Put(out interface{}, mediaType ...string) error + func (c *HttpC) Query(name, value string) *HttpC + func (c *HttpC) Reset() *HttpC + func (c *HttpC) SetContext(context *Context) *HttpC + func (c *HttpC) String() string + func (c *HttpC) SuccessStatus(sucStatus int) *HttpC + type ReqBodyReader func(req *http.Request, typ reflect.Type, data interface{}) (io.ReadCloser, error) + type RespBodyReader func(resp *http.Response, reader io.ReadCloser, typ reflect.Type, out interface{}) error + type SaveInfo struct + Mode os.FileMode + Override bool + Path string