Documentation
¶
Index ¶
- Constants
- Variables
- func BodyJSON(v interface{}) *bodyJson
- func BodyXML(v interface{}) *bodyXml
- func Client() *http.Client
- func EnableCookie(enable bool)
- func EnableInsecureTLS(enable bool)
- func File(patterns ...string) interface{}
- func Flags() int
- func SetClient(client *http.Client)
- func SetFlags(flags int)
- func SetJSONEscapeHTML(escape bool)
- func SetJSONIndent(prefix, indent string)
- func SetProxy(proxy func(*http.Request) (*url.URL, error)) error
- func SetProxyUrl(rawurl string) error
- func SetTimeout(d time.Duration)
- func SetXMLIndent(prefix, indent string)
- type DownloadProgress
- type FileUpload
- type Header
- type Host
- type Param
- type QueryParam
- type R
- func (r *R) Client() *http.Client
- func (r *R) Delete(url string, v ...interface{}) (*Res, error)
- func (r *R) Do(method, rawurl string, vs ...interface{}) (resp *Res, err error)
- func (r *R) EnableCookie(enable bool)
- func (r *R) EnableInsecureTLS(enable bool)
- func (r *R) Get(url string, v ...interface{}) (*Res, error)
- func (r *R) GetFlags() int
- func (r *R) Head(url string, v ...interface{}) (*Res, error)
- func (r *R) Options(url string, v ...interface{}) (*Res, error)
- func (r *R) Patch(url string, v ...interface{}) (*Res, error)
- func (r *R) Post(url string, v ...interface{}) (*Res, error)
- func (r *R) Put(url string, v ...interface{}) (*Res, error)
- func (r *R) SetClient(client *http.Client)
- func (r *R) SetFlags(flags int)
- func (r *R) SetJSONEscapeHTML(escape bool)
- func (r *R) SetJSONIndent(prefix, indent string)
- func (r *R) SetProxy(proxy func(*http.Request) (*url.URL, error)) error
- func (r *R) SetProxyUrl(rawurl string) error
- func (r *R) SetSsl(certPath, keyPath, CAPath string) (*tls.Config, error)
- func (r *R) SetTimeout(d time.Duration)
- func (r *R) SetXMLIndent(prefix, indent string)
- type Res
- func Delete(url string, v ...interface{}) (*Res, error)
- func Do(method, url string, v ...interface{}) (*Res, error)
- func Get(url string, v ...interface{}) (*Res, error)
- func Head(url string, v ...interface{}) (*Res, error)
- func Options(url string, v ...interface{}) (*Res, error)
- func Patch(url string, v ...interface{}) (*Res, error)
- func Post(url string, v ...interface{}) (*Res, error)
- func Put(url string, v ...interface{}) (*Res, error)
- func (r *Res) Bytes() []byte
- func (r *Res) Cost() time.Duration
- func (r *Res) Dump() string
- func (r *Res) Format(s fmt.State, verb rune)
- func (r *Res) Request() *http.Request
- func (r *Res) Response() *http.Response
- func (r *Res) String() string
- func (r *Res) ToBytes() ([]byte, error)
- func (r *Res) ToFile(name string) error
- func (r *Res) ToJSON(v interface{}) error
- func (r *Res) ToString() (string, error)
- func (r *Res) ToXML(v interface{}) error
- func (m Res) Upload(req *http.Request)
- type UploadProgress
Constants ¶
View Source
const ( BitReqHead = 1 << iota BitReqBody BitRespHead BitRespBody BitTime BitStdFlags = BitReqHead | BitReqBody | BitRespHead | BitRespBody )
Variables ¶
View Source
var ( ErrNoTransport = errors.New("no transport") ErrUrlNotSpecified = errors.New("url not specified") ErrTransEmpty = errors.New("trans is empty") ErrNoMatched = errors.New("no file have been matched") )
View Source
var Debug = false
Functions ¶
func BodyJSON ¶
func BodyJSON(v interface{}) *bodyJson
BodyJSON make the object be encoded in json format and set it to the request body
func BodyXML ¶
func BodyXML(v interface{}) *bodyXml
BodyXML make the object be encoded in xml format and set it to the request body
func EnableCookie ¶
func EnableCookie(enable bool)
func EnableInsecureTLS ¶
func EnableInsecureTLS(enable bool)
func SetJSONEscapeHTML ¶
func SetJSONEscapeHTML(escape bool)
func SetJSONIndent ¶
func SetJSONIndent(prefix, indent string)
func SetProxyUrl ¶
func SetTimeout ¶
func SetXMLIndent ¶
func SetXMLIndent(prefix, indent string)
Types ¶
type DownloadProgress ¶
type DownloadProgress func(current, total int64)
type FileUpload ¶
type FileUpload struct { FileName string FieldName string File io.ReadCloser }
type QueryParam ¶
type QueryParam map[string]interface{}
type R ¶ added in v0.1.0
type R struct {
// contains filtered or unexported fields
}
func (*R) EnableCookie ¶ added in v0.1.0
func (*R) EnableInsecureTLS ¶ added in v0.1.0
func (*R) SetJSONEscapeHTML ¶ added in v0.1.0
func (*R) SetJSONIndent ¶ added in v0.1.0
func (*R) SetProxyUrl ¶ added in v0.1.0
func (*R) SetTimeout ¶ added in v0.1.0
func (*R) SetXMLIndent ¶ added in v0.1.0
type UploadProgress ¶
type UploadProgress func(current, total int64)
Click to show internal directories.
Click to hide internal directories.