Documentation
¶
Index ¶
- type Client
- type ErrorResponse
- type Option
- func WithBaseURL(baseURL string) Option
- func WithClientCert(certPath, keyPath string) Option
- func WithCookieJar() Option
- func WithDebug(enable bool) Option
- func WithHeaders(headers map[string]string) Option
- func WithInsecureSkipVerify() Option
- func WithProxy(proxyURL string) Option
- func WithRetry(count int, waitTime, maxWaitTime time.Duration) Option
- func WithRootCA(caCertPath string) Option
- func WithTLSConfig(tlsConfig *tls.Config) Option
- func WithTimeout(timeout time.Duration) Option
- func WithTransport(transport *http.Transport) Option
- type Request
- func (r *Request) Delete(url string) (*Response, error)
- func (r *Request) Get(url string) (*Response, error)
- func (r *Request) Patch(url string) (*Response, error)
- func (r *Request) Post(url string) (*Response, error)
- func (r *Request) Put(url string) (*Response, error)
- func (r *Request) SetAuthToken(token string) *Request
- func (r *Request) SetBody(body interface{}) *Request
- func (r *Request) SetError(err interface{}) *Request
- func (r *Request) SetHeader(key, value string) *Request
- func (r *Request) SetHeaders(headers map[string]string) *Request
- func (r *Request) SetQueryParam(key, value string) *Request
- func (r *Request) SetQueryParams(params map[string]string) *Request
- func (r *Request) SetResult(result interface{}) *Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.1.80
type Client struct {
// contains filtered or unexported fields
}
Client 封装了resty客户端
type ErrorResponse ¶ added in v1.1.80
ErrorResponse 错误响应结构
func (*ErrorResponse) Error ¶ added in v1.1.80
func (e *ErrorResponse) Error() string
Error 实现error接口
type Option ¶
type Option func(*Client)
Option 客户端配置选项
func WithClientCert ¶ added in v1.1.80
WithClientCert 加载客户端证书和私钥
func WithInsecureSkipVerify ¶ added in v1.1.80
func WithInsecureSkipVerify() Option
WithInsecureSkipVerify 跳过证书验证(仅用于测试环境)
func WithTLSConfig ¶ added in v1.1.80
WithTLSConfig 设置TLS配置
func WithTransport ¶ added in v1.1.80
WithTransport 设置自定义 Transport
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request 请求构建器
func (*Request) SetAuthToken ¶ added in v1.1.80
SetAuthToken 设置Bearer Token
func (*Request) SetHeaders ¶
SetHeaders 批量设置请求头
func (*Request) SetQueryParam ¶ added in v1.1.80
SetQueryParam 设置查询参数
func (*Request) SetQueryParams ¶ added in v1.1.80
SetQueryParams 批量设置查询参数
Click to show internal directories.
Click to hide internal directories.