Documentation ¶
Index ¶
- func Init(iOpt *Option)
- func Release()
- type Engine
- func (E *Engine) BaseHeader(iBaseHeader []HTTPOption)
- func (E *Engine) DO(iCtx context.Context, iReq *Request) (*Response, error)
- func (E *Engine) GET(iCtx context.Context, iURL string, iParams map[string]string, ...) ([]byte, error)
- func (E *Engine) JSON(iCtx context.Context, iURL string, iObject interface{}, iHeader ...HTTPOption) ([]byte, error)
- func (E *Engine) POST(iCtx context.Context, iURL string, iArgs map[string]string, ...) ([]byte, error)
- type HTTPOption
- type Option
- type Request
- type Response
- type RetryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine 用于描述一个httpclient
func (*Engine) BaseHeader ¶
func (E *Engine) BaseHeader(iBaseHeader []HTTPOption)
BaseHeader 设置baseheader
func (*Engine) GET ¶
func (E *Engine) GET( iCtx context.Context, iURL string, iParams map[string]string, iHeader ...HTTPOption, ) ( []byte, error, )
GET 用于发送get请求
type HTTPOption ¶
HTTPOption 定义一个http的选项
type Option ¶
type Option struct { MaxIdleConns int `yaml:"max_idle_conns"` IdleConnTimeout int `yaml:"idle_conn_timeout"` MaxIdleConnsPerHost int `yaml:"max_idle_conn_per_host"` DisableCompression bool `yaml:"disable_compress"` SkipTLSVerify bool `yaml:"skip_tls_verify"` RetryInterval int `yaml:"retry_interval"` RetryCount int `yaml:"retry_count"` EnableProxy bool `yaml:"enable_proxy"` ProxyAddr string `yaml:"proxy_addr"` EnableHTTP2 bool `yaml:"enable_http2"` // contains filtered or unexported fields }
Option 用于描述一个选项配置
type Request ¶
type Request struct { Method string URL string Body []byte Header []HTTPOption }
Request 用于描述一个请求
type RetryConfig ¶
type RetryConfig struct {
// contains filtered or unexported fields
}
RetryConfig 重试配置
Click to show internal directories.
Click to hide internal directories.