Documentation
¶
Index ¶
- Constants
- Variables
- func Get(url string, options ...Option) (int, []byte, error)
- func GetForResponse(url string, options ...Option) (*http.Response, error)
- func IsTimeoutError(err error) (flag bool)
- func NewHttpClient(timeout time.Duration, insecureSkipVerify bool) *http.Client
- 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 发送请求的默认超时时间. DefaultTimeout = time.Second * 10 )
Variables ¶
View Source
var DefaultHttpClient *http.Client = NewHttpClient(time.Second*3, true)
DefaultHttpClient 默认的 *http.Client 实例
Functions ¶
func GetForResponse ¶
GetForResponse Deprecated: Use req111Kit instead.
!!!: 第2个返回值 == nil 的情况下,需要手动调用 resp.Body.Close() 来手动关闭 第1个返回值.
func NewHttpClient ¶ added in v3.0.67
NewHttpClient
@param insecureSkipVerify true: 跳过https证书验证(适用于: https证书是自己生成的,非法的)
func PostForResponse ¶
PostForResponse Deprecated: Use req111Kit instead.
!!!: 第2个返回值 == nil 的情况下,需要手动调用 resp.Body.Close() 来手动关闭 第1个返回值.
func UploadForResponse ¶
func UploadForResponse(url string, fileParams map[string]string, options ...Option) (*http.Response, error)
UploadForResponse Deprecated: Use req111Kit instead.
@param fileParams (1)可以为nil或空;
(2)key: 键, value: 要上传文件的路径.
@return !!!: 第一个返回值如果不为nil的话,一般来说需要手动调用 "resp.Body.Close()"
Types ¶
type Option ¶
type Option func(opts *options)
Click to show internal directories.
Click to hide internal directories.