Documentation ¶
Index ¶
- Constants
- Variables
- func CallRet(ret interface{}, resp *http.Response) (err error)
- func NewTransportTimeout(dial, resp time.Duration) http.RoundTripper
- func NewTransportTimeoutWithConnsPool(dial, resp time.Duration, poolSize int) http.RoundTripper
- func ResponseError(resp *http.Response) (err error)
- type Client
- func (r Client) Call(ret interface{}, url1 string) (err error)
- func (r Client) CallWith(ret interface{}, url1 string, bodyType string, body io.Reader, bodyLength int) (err error)
- func (r Client) CallWith64(ret interface{}, url1 string, bodyType string, body io.Reader, ...) (err error)
- func (r Client) CallWithForm(ret interface{}, url1 string, param map[string][]string) (err error)
- func (r Client) CallWithJSON(ret interface{}, url1 string, param interface{}) (err error)
- func (r Client) Delete(url string) (resp *http.Response, err error)
- func (r Client) DeleteCall(ret interface{}, url string) (err error)
- func (r Client) Do(req *http.Request) (resp *http.Response, err error)
- func (r Client) Get(url string) (resp *http.Response, err error)
- func (r Client) GetCall(ret interface{}, url1 string) (err error)
- func (r Client) GetCallWithForm(ret interface{}, url1 string, param map[string][]string) (err error)
- func (r Client) Head(url string) (resp *http.Response, err error)
- func (r Client) PostEx(url string) (resp *http.Response, err error)
- func (r Client) PostWith(url1 string, bodyType string, body io.Reader, bodyLength int) (resp *http.Response, err error)
- func (r Client) PostWith64(url1 string, bodyType string, body io.Reader, bodyLength int64) (resp *http.Response, err error)
- func (r Client) PostWithForm(url1 string, data map[string][]string) (resp *http.Response, err error)
- func (r Client) PostWithJSON(url1 string, data interface{}) (resp *http.Response, err error)
- func (r Client) PutCall(ret interface{}, url1 string) (err error)
- func (r Client) PutCallWith(ret interface{}, url1 string, bodyType string, body io.Reader, bodyLength int) (err error)
- func (r Client) PutCallWith64(ret interface{}, url1 string, bodyType string, body io.Reader, ...) (err error)
- func (r Client) PutCallWithForm(ret interface{}, url1 string, param map[string][]string) (err error)
- func (r Client) PutCallWithJSON(ret interface{}, url1 string, param interface{}) (err error)
- func (r Client) PutEx(url string) (resp *http.Response, err error)
- func (r Client) PutWith(url1 string, bodyType string, body io.Reader, bodyLength int) (resp *http.Response, err error)
- func (r Client) PutWith64(url1 string, bodyType string, body io.Reader, bodyLength int64) (resp *http.Response, err error)
- func (r Client) PutWithForm(url1 string, data map[string][]string) (resp *http.Response, err error)
- func (r Client) PutWithJSON(url1 string, data interface{}) (resp *http.Response, err error)
- type ErrorInfo
Constants ¶
const DefaultDailTimeout = time.Duration(5) * time.Second
DefaultDailTimeout 默认超时时间: 5秒
Variables ¶
var DefaultClient = Client{&http.Client{Transport: DefaultTransport}}
DefaultClient a golang default http client
var DefaultTransport = NewTransportTimeout(DefaultDailTimeout, 0)
DefaultTransport 默认 HTTP Transport
var UserAgent = "Golang qiniu/rpc package"
UserAgent user agent
Functions ¶
func NewTransportTimeout ¶
func NewTransportTimeout(dial, resp time.Duration) http.RoundTripper
NewTransportTimeout 返回指定超时时间的 Transport 对象
func NewTransportTimeoutWithConnsPool ¶
func NewTransportTimeoutWithConnsPool(dial, resp time.Duration, poolSize int) http.RoundTripper
NewTransportTimeoutWithConnsPool 返回指定超时时间和最大连接主机数的 Transport 对象
func ResponseError ¶
ResponseError return response error
Types ¶
type Client ¶
Client a golang http client
func NewClientTimeout ¶
NewClientTimeout return a golang http client
func (Client) CallWith ¶
func (r Client) CallWith(ret interface{}, url1 string, bodyType string, body io.Reader, bodyLength int) (err error)
CallWith send post method request with url, bodyType, body and bodyLength then parse response
func (Client) CallWith64 ¶
func (r Client) CallWith64(ret interface{}, url1 string, bodyType string, body io.Reader, bodyLength int64) (err error)
CallWith64 send post method request with url, bodyType, body and bodyLength(64) then parse response
func (Client) CallWithForm ¶
CallWithForm send post method request with url and form data then parse response
func (Client) CallWithJSON ¶
CallWithJSON send post method request with url and application/json data then parse response
func (Client) DeleteCall ¶
DeleteCall send delete method request with url
func (Client) GetCallWithForm ¶
func (r Client) GetCallWithForm(ret interface{}, url1 string, param map[string][]string) (err error)
GetCallWithForm send get method request with url and param then parse response
func (Client) PostWith ¶
func (r Client) PostWith(url1 string, bodyType string, body io.Reader, bodyLength int) (resp *http.Response, err error)
PostWith send post method request with url, bodyType, body and bodyLength
func (Client) PostWith64 ¶
func (r Client) PostWith64(url1 string, bodyType string, body io.Reader, bodyLength int64) (resp *http.Response, err error)
PostWith64 send post method request with url, bodyType, body and bodyLength(64)
func (Client) PostWithForm ¶
func (r Client) PostWithForm(url1 string, data map[string][]string) (resp *http.Response, err error)
PostWithForm send post method request with url and form data
func (Client) PostWithJSON ¶
PostWithJSON send post method request with url and application/json data
func (Client) PutCallWith ¶
func (r Client) PutCallWith(ret interface{}, url1 string, bodyType string, body io.Reader, bodyLength int) (err error)
PutCallWith send put method request with url, bodyType, body and bodyLength then parse response
func (Client) PutCallWith64 ¶
func (r Client) PutCallWith64(ret interface{}, url1 string, bodyType string, body io.Reader, bodyLength int64) (err error)
PutCallWith64 send post method request with url, bodyType, body and bodyLength(64) then parse response
func (Client) PutCallWithForm ¶
func (r Client) PutCallWithForm(ret interface{}, url1 string, param map[string][]string) (err error)
PutCallWithForm send put method request with url and param then parse response
func (Client) PutCallWithJSON ¶
PutCallWithJSON send put method request with url and param then parse response
func (Client) PutWith ¶
func (r Client) PutWith(url1 string, bodyType string, body io.Reader, bodyLength int) (resp *http.Response, err error)
PutWith send put method request with url, bodyType, body and bodyLength
func (Client) PutWith64 ¶
func (r Client) PutWith64(url1 string, bodyType string, body io.Reader, bodyLength int64) (resp *http.Response, err error)
PutWith64 send put method request with url, bodyType, body and bodyLength(64)
func (Client) PutWithForm ¶
PutWithForm send put method request with url and form data