Documentation ¶
Index ¶
- Variables
- type FormFile
- type GetOrDeleteExecutor
- func (r *GetOrDeleteExecutor) AddHeader(name string, value interface{}) *GetOrDeleteExecutor
- func (r *GetOrDeleteExecutor) AddParameter(name string, value interface{}) *GetOrDeleteExecutor
- func (r *GetOrDeleteExecutor) AddParameters(values H) *GetOrDeleteExecutor
- func (r *GetOrDeleteExecutor) AddRetryConditionFunc(_retryCondition RetryConditionFunc) *GetOrDeleteExecutor
- func (r *GetOrDeleteExecutor) Do() (*http.Response, error)
- func (r *GetOrDeleteExecutor) DoForEntity() (*RespondEntity, error)
- func (r *GetOrDeleteExecutor) DoForString() (string, error)
- func (r *GetOrDeleteExecutor) SetExpectStatus(expect int) *GetOrDeleteExecutor
- func (r *GetOrDeleteExecutor) SetHeaders(values H) *GetOrDeleteExecutor
- func (r *GetOrDeleteExecutor) SetRetryCount(_retryCount int) *GetOrDeleteExecutor
- func (r *GetOrDeleteExecutor) SetRetryInterval(_retryInterval int) *GetOrDeleteExecutor
- type H
- type HttpClient
- func (c *HttpClient) AddHeader(key string, val string) *HttpClient
- func (c *HttpClient) AddHeaders(values H) *HttpClient
- func (c *HttpClient) AddRetryConditionFunc(retryCondition RetryConditionFunc) *HttpClient
- func (c *HttpClient) DELETE(url string) *GetOrDeleteExecutor
- func (c *HttpClient) GET(url string) *GetOrDeleteExecutor
- func (c *HttpClient) GetRetryCount() int
- func (c *HttpClient) GetRetryInterval() int
- func (c *HttpClient) GetTimeout() int
- func (c *HttpClient) POST(url string) *PostOrPutExecutor
- func (c *HttpClient) PUT(url string) *PostOrPutExecutor
- func (c *HttpClient) SetLogger(logger *zap.Logger)
- func (c *HttpClient) SetRetryCount(retryCount int) *HttpClient
- func (c *HttpClient) SetRetryInterval(retryInterval int) *HttpClient
- func (c *HttpClient) SetTimeout(timeout int) *HttpClient
- func (c *HttpClient) SetTransport(transport http.RoundTripper) *HttpClient
- type PostOrPutExecutor
- func (r *PostOrPutExecutor) AddHeader(name string, value interface{}) *PostOrPutExecutor
- func (r *PostOrPutExecutor) AddRetryConditionFunc(_retryCondition RetryConditionFunc) *PostOrPutExecutor
- func (r *PostOrPutExecutor) Do() (*http.Response, error)
- func (r *PostOrPutExecutor) DoForEntity() (*RespondEntity, error)
- func (r *PostOrPutExecutor) DoForString() (string, error)
- func (r *PostOrPutExecutor) SetBodyAsForm(body H) *PostOrPutExecutor
- func (r *PostOrPutExecutor) SetBodyAsJson(body interface{}) *PostOrPutExecutor
- func (r *PostOrPutExecutor) SetExpectStatus(expect int) *PostOrPutExecutor
- func (r *PostOrPutExecutor) SetHeaders(values H) *PostOrPutExecutor
- func (r *PostOrPutExecutor) SetRetryCount(_retryCount int) *PostOrPutExecutor
- func (r *PostOrPutExecutor) SetRetryInterval(_retryInterval int) *PostOrPutExecutor
- type RespondEntity
- type RetryConditionFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClient = NewClient()
Functions ¶
This section is empty.
Types ¶
type GetOrDeleteExecutor ¶
type GetOrDeleteExecutor struct {
// contains filtered or unexported fields
}
func (*GetOrDeleteExecutor) AddHeader ¶
func (r *GetOrDeleteExecutor) AddHeader(name string, value interface{}) *GetOrDeleteExecutor
设置请求头
func (*GetOrDeleteExecutor) AddParameter ¶
func (r *GetOrDeleteExecutor) AddParameter(name string, value interface{}) *GetOrDeleteExecutor
设置查询参数
func (*GetOrDeleteExecutor) AddParameters ¶
func (r *GetOrDeleteExecutor) AddParameters(values H) *GetOrDeleteExecutor
设置查询参数
func (*GetOrDeleteExecutor) AddRetryConditionFunc ¶
func (r *GetOrDeleteExecutor) AddRetryConditionFunc(_retryCondition RetryConditionFunc) *GetOrDeleteExecutor
添加重试条件
func (*GetOrDeleteExecutor) DoForEntity ¶
func (r *GetOrDeleteExecutor) DoForEntity() (*RespondEntity, error)
func (*GetOrDeleteExecutor) DoForString ¶
func (r *GetOrDeleteExecutor) DoForString() (string, error)
func (*GetOrDeleteExecutor) SetExpectStatus ¶
func (r *GetOrDeleteExecutor) SetExpectStatus(expect int) *GetOrDeleteExecutor
设置预期请求状态
func (*GetOrDeleteExecutor) SetHeaders ¶
func (r *GetOrDeleteExecutor) SetHeaders(values H) *GetOrDeleteExecutor
设置请求头
func (*GetOrDeleteExecutor) SetRetryCount ¶
func (r *GetOrDeleteExecutor) SetRetryCount(_retryCount int) *GetOrDeleteExecutor
设置重试次数
func (*GetOrDeleteExecutor) SetRetryInterval ¶
func (r *GetOrDeleteExecutor) SetRetryInterval(_retryInterval int) *GetOrDeleteExecutor
设置重试间隔时间,单位为秒
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func (*HttpClient) AddHeader ¶
func (c *HttpClient) AddHeader(key string, val string) *HttpClient
添加请求头
func (*HttpClient) AddRetryConditionFunc ¶
func (c *HttpClient) AddRetryConditionFunc(retryCondition RetryConditionFunc) *HttpClient
添加重试条件
func (*HttpClient) SetLogger ¶
func (c *HttpClient) SetLogger(logger *zap.Logger)
func (*HttpClient) SetRetryCount ¶
func (c *HttpClient) SetRetryCount(retryCount int) *HttpClient
设置重试次数
func (*HttpClient) SetRetryInterval ¶
func (c *HttpClient) SetRetryInterval(retryInterval int) *HttpClient
设置重试间隔时间,单位为秒
func (*HttpClient) SetTimeout ¶
func (c *HttpClient) SetTimeout(timeout int) *HttpClient
设置超时时间,单位为秒
func (*HttpClient) SetTransport ¶
func (c *HttpClient) SetTransport(transport http.RoundTripper) *HttpClient
设置Transport (用于确定HTTP请求的创建机制) 如果为空,将会使用DefaultTransport
type PostOrPutExecutor ¶
type PostOrPutExecutor struct {
// contains filtered or unexported fields
}
func (*PostOrPutExecutor) AddHeader ¶
func (r *PostOrPutExecutor) AddHeader(name string, value interface{}) *PostOrPutExecutor
设置请求头
func (*PostOrPutExecutor) AddRetryConditionFunc ¶
func (r *PostOrPutExecutor) AddRetryConditionFunc(_retryCondition RetryConditionFunc) *PostOrPutExecutor
添加重试条件
func (*PostOrPutExecutor) DoForEntity ¶
func (r *PostOrPutExecutor) DoForEntity() (*RespondEntity, error)
func (*PostOrPutExecutor) DoForString ¶
func (r *PostOrPutExecutor) DoForString() (string, error)
func (*PostOrPutExecutor) SetBodyAsForm ¶
func (r *PostOrPutExecutor) SetBodyAsForm(body H) *PostOrPutExecutor
func (*PostOrPutExecutor) SetBodyAsJson ¶
func (r *PostOrPutExecutor) SetBodyAsJson(body interface{}) *PostOrPutExecutor
设置请求的contentType 为: "application/json"
func (*PostOrPutExecutor) SetExpectStatus ¶
func (r *PostOrPutExecutor) SetExpectStatus(expect int) *PostOrPutExecutor
设置预期请求状态
func (*PostOrPutExecutor) SetHeaders ¶
func (r *PostOrPutExecutor) SetHeaders(values H) *PostOrPutExecutor
设置请求头
func (*PostOrPutExecutor) SetRetryCount ¶
func (r *PostOrPutExecutor) SetRetryCount(_retryCount int) *PostOrPutExecutor
设置重试次数
func (*PostOrPutExecutor) SetRetryInterval ¶
func (r *PostOrPutExecutor) SetRetryInterval(_retryInterval int) *PostOrPutExecutor
设置重试间隔时间,单位为秒
type RespondEntity ¶
type RespondEntity struct {
// contains filtered or unexported fields
}
应答实体
func (*RespondEntity) Data ¶
func (t *RespondEntity) Data() []byte
func (*RespondEntity) DataAsString ¶
func (t *RespondEntity) DataAsString() string
func (*RespondEntity) StatusCode ¶
func (t *RespondEntity) StatusCode() int
func (*RespondEntity) StatusText ¶
func (t *RespondEntity) StatusText() string
func (*RespondEntity) Unmarshal ¶
func (t *RespondEntity) Unmarshal(entity interface{}) error
Click to show internal directories.
Click to hide internal directories.