Documentation ¶
Index ¶
- Constants
- func Delete(url string, form httpURL.Values, options ...Option) (body []byte, err error)
- func Get(url string, form httpURL.Values, options ...Option) (body []byte, err error)
- func PatchFrom(url string, form httpURL.Values, options ...Option) (body []byte, err error)
- func PatchJSON(url string, raw json.RawMessage, options ...Option) (body []byte, err error)
- func PostForm(url string, form httpURL.Values, options ...Option) (body []byte, err error)
- func PostJSON(url string, raw json.RawMessage, options ...Option) (body []byte, err error)
- func PutForm(url string, form httpURL.Values, options ...Option) (body []byte, err error)
- func PutJSON(url string, raw json.RawMessage, options ...Option) (body []byte, err error)
- type AlarmObject
- type AlarmVerify
- type Mock
- type Option
- func WithHeader(key, value string) Option
- func WithLogger(logger *zap.Logger) Option
- func WithMock(m Mock) Option
- func WithOnFailedAlarm(alarmTitle string, alarmObject AlarmObject, alarmVerify AlarmVerify) Option
- func WithOnFailedRetry(retryTimes int, retryDelay time.Duration, retryVerify RetryVerify) Option
- func WithTTL(ttl time.Duration) Option
- func WithTrace(t trace.T) Option
- type ReplyErr
- type RetryVerify
Constants ¶
View Source
const ( // DefaultRetryTimes 如果请求失败,最多重试3次 DefaultRetryTimes = 3 // DefaultRetryDelay 在重试前,延迟等待100毫秒 DefaultRetryDelay = time.Millisecond * 100 )
View Source
const ( // DefaultTTL 一次http请求最长执行1分钟 DefaultTTL = time.Minute )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlarmObject ¶
type AlarmVerify ¶
AlarmVerify Verify parse the body and verify that it is correct
type Option ¶
type Option func(*option)
Option 自定义设置http请求
func WithHeader ¶
WithHeader 设置http header,可以调用多次设置多对key-value
func WithOnFailedAlarm ¶
func WithOnFailedAlarm(alarmTitle string, alarmObject AlarmObject, alarmVerify AlarmVerify) Option
WithOnFailedAlarm 设置告警通知
func WithOnFailedRetry ¶
func WithOnFailedRetry(retryTimes int, retryDelay time.Duration, retryVerify RetryVerify) Option
WithOnFailedRetry 设置失败重试
type RetryVerify ¶
RetryVerify Verify parse the body and verify that it is correct
Click to show internal directories.
Click to hide internal directories.