Documentation
¶
Index ¶
- Constants
- func Delete(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
- func Get(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
- func PatchFrom(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
- func PatchJSON(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, err error)
- func PostForm(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
- func PostJSON(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, err error)
- func PutForm(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
- func PutJSON(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, err error)
- func QueryUnescape(uri string) string
- func ToReplyErr(err error) (statusCode int, _ error, _ bool)
- type Journal
- type Option
- func WithContext(ctx context.Context) Option
- func WithHeader(key, value string) Option
- func WithJournal(j Journal) Option
- func WithLogger(logger *zap.Logger) Option
- func WithMarshalJournal() Option
- func WithNewJournal(id string) Option
- func WithPrintJournal(desc string) Option
- func WithRetryDelay(retryDelay time.Duration) Option
- func WithRetryTimes(retryTimes int) Option
- func WithTTL(ttl time.Duration) Option
- type ReplyErr
Constants ¶
View Source
const ( // DefaultTTL 一次http请求最长执行10秒钟 DefaultTTL = time.Second * 10 // DefaultRetryTimes 如果请求失败,最多重试3次 DefaultRetryTimes = 3 // DefaultRetryDelay 在重试前,延迟等待100毫秒 DefaultRetryDelay = time.Millisecond * 100 )
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
Delete delete 请求
func Get ¶
func Get(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
Get get 请求
func PatchFrom ¶
func PatchFrom(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
PatchFrom patch form 请求
func PatchJSON ¶
func PatchJSON(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, err error)
PatchJSON patch json 请求
func PostForm ¶
func PostForm(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
PostForm post form 请求
func PostJSON ¶
func PostJSON(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, err error)
PostJSON post json 请求
func PutForm ¶
func PutForm(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, err error)
PutForm put form 请求
func PutJSON ¶
func PutJSON(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, err error)
PutJSON put json 请求
func QueryUnescape ¶
Types ¶
type Option ¶
type Option func(*option)
Option 自定义设置http请求
func WithHeader ¶
WithHeader 设置http header,可以调用多次设置多对key-value
func WithRetryDelay ¶
WithRetryDelay 在重试前,延迟等待一会