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 if request failed, retry 3 times at most DefaultRetryTimes = 3 // DefaultRetryDelay before retry, wait and delay for 100ms DefaultRetryDelay = time.Millisecond * 100 )
View Source
const ( // DefaultTTL The longest execution time for an HTTP request is 1 minute 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 customize http request options
func WithHeader ¶
WithHeader set http header,can call multiple and set multiple key-value pairs
func WithOnFailedAlarm ¶
func WithOnFailedAlarm(alarmTitle string, alarmObject AlarmObject, alarmVerify AlarmVerify) Option
WithOnFailedAlarm set alert notice
func WithOnFailedRetry ¶
func WithOnFailedRetry(retryTimes int, retryDelay time.Duration, retryVerify RetryVerify) Option
WithOnFailedRetry set failure retry
type ReplyErr ¶
ReplyErr error response,when resp.StatusCode != http.StatusOK used for wrapper response httpCode and body 。
func ToReplyErr ¶
ToReplyErr try to convert err to ReplyErr
type RetryVerify ¶
RetryVerify Verify parse the body and verify that it is correct
Click to show internal directories.
Click to hide internal directories.