Documentation ¶
Index ¶
- Constants
- func Get(url string, options ...Option) (int, []byte, error)
- func GetForResponse(url string, options ...Option) (*http.Response, error)
- func IsCodeValid(code int) bool
- func Post(url string, options ...Option) (int, []byte, error)
- func PostForResponse(url string, options ...Option) (*http.Response, error)
- func Upload(url string, fileParams map[string]string, options ...Option) (int, []byte, error)
- func UploadForResponse(url string, fileParams map[string]string, options ...Option) (*http.Response, error)
- type Option
Constants ¶
View Source
const ( // DefaultTimeout 发送请求的默认超时时间. /* PS: (1) 个人实测,对于 http.Client 结构体,Timeout 默认为30s. (2) e.g. yozo的网访问谷歌必定超时. */ DefaultTimeout = time.Second * 10 )
Variables ¶
This section is empty.
Functions ¶
func GetForResponse ¶ added in v2.0.13
GetForResponse
@return !!!: 第一个返回值如果不为nil的话,一般来说需要手动调用 "resp.Body.Close()"
func IsCodeValid ¶ added in v2.0.16
IsCodeValid 响应的http状态码 是否有效?
PS: (1) 判断参考了jQuery; (2) 正常情况下,响应的http状态码有效的情况下,才会去读取响应的body.
func PostForResponse ¶ added in v2.0.13
PostForResponse
@return !!!: 第一个返回值如果不为nil的话,一般来说需要手动调用 "resp.Body.Close()"
Types ¶
type Option ¶ added in v2.0.13
type Option func(opts *options)
Click to show internal directories.
Click to hide internal directories.