Documentation ¶
Index ¶
- type Config
- type File
- type HTTPTimeout
- type Option
- func DisableNon20xIsError() Option
- func WithBasicAuth(username, password string) Option
- func WithBodyFiles(files []File, fieldsKeyPairs ...string) Option
- func WithBodyForm(keyPairs ...string) Option
- func WithBodyJson(body interface{}, escape ...bool) Option
- func WithClient(client *http.Client) Option
- func WithConfig(config *Config) Option
- func WithHeader(keyPairs ...string) Option
- func WithMethodConnect() Option
- func WithMethodDelete() Option
- func WithMethodHead() Option
- func WithMethodOptions() Option
- func WithMethodPatch() Option
- func WithMethodPost() Option
- func WithMethodPut() Option
- func WithMethodTrace() Option
- func WithQuery(keyPairs ...string) Option
- func WithResponseBodyToJson(unwrapTarget interface{}) Option
- func WithResponseBodyWriteTo(responseBodyWriteTo io.ReadWriter) Option
- func WithRetry(retryTimes uint8, retryInterval time.Duration) Option
- func WithRetryTimes(retryTimes uint8) Option
- type Request
- func CONNECT(rawURL string, options ...Option) (*Request, error)
- func DELETE(rawURL string, options ...Option) (*Request, error)
- func Do(rawURL string, options ...Option) (*Request, error)
- func GET(rawURL string, options ...Option) (*Request, error)
- func HEAD(rawURL string, options ...Option) (*Request, error)
- func NewRequest(rawURL string, options ...Option) *Request
- func OPTIONS(rawURL string, options ...Option) (*Request, error)
- func PATCH(rawURL string, options ...Option) (*Request, error)
- func POST(rawURL string, options ...Option) (*Request, error)
- func PUT(rawURL string, options ...Option) (*Request, error)
- func TRACE(rawURL string, options ...Option) (*Request, error)
- type UnwrapType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { HTTPTimeout HTTPTimeout // HTTP的超时时间设置 UseProxy bool // 是否使用代理 ProxyHost string // 代理服务器地址 IsAuthProxy bool // 代理服务器是否使用用户认证 ProxyUser string // 代理服务器认证用户名 ProxyPassword string // 代理服务器认证密码 ReUseTCP bool // 为同一地址多次请求复用TCP连接 InsecureSkipVerify bool // 忽略证书验证 }
Config configure
type HTTPTimeout ¶
type HTTPTimeout struct { ConnectTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration HeaderTimeout time.Duration MaxTimeout time.Duration }
HTTPTimeout http timeout
type Option ¶
type Option func(request *Request)
func DisableNon20xIsError ¶ added in v0.0.3
func DisableNon20xIsError() Option
func WithBasicAuth ¶
func WithBodyFiles ¶
func WithBodyForm ¶
func WithBodyJson ¶
func WithClient ¶
func WithConfig ¶
func WithHeader ¶
func WithMethodConnect ¶
func WithMethodConnect() Option
func WithMethodDelete ¶
func WithMethodDelete() Option
func WithMethodHead ¶
func WithMethodHead() Option
func WithMethodOptions ¶
func WithMethodOptions() Option
func WithMethodPatch ¶
func WithMethodPatch() Option
func WithMethodPost ¶
func WithMethodPost() Option
func WithMethodPut ¶
func WithMethodPut() Option
func WithMethodTrace ¶
func WithMethodTrace() Option
func WithResponseBodyToJson ¶
func WithResponseBodyToJson(unwrapTarget interface{}) Option
func WithResponseBodyWriteTo ¶
func WithResponseBodyWriteTo(responseBodyWriteTo io.ReadWriter) Option
func WithRetryTimes ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
NewRequest deprecated method
func (*Request) StatusCode ¶
type UnwrapType ¶
type UnwrapType string
const ( UnwrapTypeJson UnwrapType = "Json" UnwrapTypeReadWriter UnwrapType = "ReadWriter" )
Click to show internal directories.
Click to hide internal directories.