Documentation
¶
Index ¶
- Constants
- func DeleteJson(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
- func GetJson(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
- func PatchJSON(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
- func PostJSON(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
- func PutJSON(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
- type AlarmObject
- type AlarmVerify
- type Mock
- type OptionHandler
- func WithHeader(key, value string) OptionHandler
- func WithLogger(logger *zap.Logger) OptionHandler
- func WithMock(m Mock) OptionHandler
- func WithOnFailedAlarm(alarmTitle string, alarmObject AlarmObject, alarmVerify AlarmVerify) OptionHandler
- func WithTTL(ttl time.Duration) OptionHandler
- func WithTrace(t trace.T) OptionHandler
- type ReplyErr
- type RequestFunc
Constants ¶
View Source
const ( // DefaultTTL 一次http请求最长执行1分钟. DefaultTTL = time.Minute )
Variables ¶
This section is empty.
Functions ¶
func DeleteJson ¶
func DeleteJson(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
DeleteJson delete 请求.
func GetJson ¶
func GetJson(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
GetJson get 请求.
func PatchJSON ¶
func PatchJSON(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
PatchJSON patch json 请求.
Types ¶
type AlarmObject ¶
type AlarmVerify ¶
AlarmVerify Verify parse the body and verify that it is correct.
type OptionHandler ¶
type OptionHandler func(*option)
OptionHandler 自定义设置http请求.
func WithHeader ¶
func WithHeader(key, value string) OptionHandler
WithHeader 设置http header,可以调用多次设置多对key-value.
func WithOnFailedAlarm ¶
func WithOnFailedAlarm(alarmTitle string, alarmObject AlarmObject, alarmVerify AlarmVerify) OptionHandler
WithOnFailedAlarm 设置告警通知.
type RequestFunc ¶
type RequestFunc func(url string, requestData interface{}, options ...OptionHandler) (body []byte, httpCode int, err error)
Click to show internal directories.
Click to hide internal directories.