Documentation
¶
Index ¶
- Constants
- func Delete(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func Get(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PatchFromBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PatchJSONBody(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PatchNoBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PostFormBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PostJSONBody(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PostNoBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PutFormBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PutJSONBody(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func PutNoBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
- func QueryEscapePath(path string) string
- 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 WithNewJournal(id string) Option
- func WithPrintJournal(desc string) Option
- func WithQueryForm(form url.Values) 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, statusCode int, err error)
Delete delete 请求
func Get ¶
func Get(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
Get get 请求
func PatchFromBody ¶ added in v1.1.16
func PatchFromBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PatchFromBody patch form 请求
func PatchJSONBody ¶ added in v1.1.16
func PatchJSONBody(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PatchJSONBody patch json 请求
func PatchNoBody ¶ added in v1.1.16
func PatchNoBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PatchNoBody patch 请求
func PostFormBody ¶ added in v1.1.16
func PostFormBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PostFormBody post form 请求
func PostJSONBody ¶ added in v1.1.16
func PostJSONBody(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PostJSONBody post json 请求
func PostNoBody ¶ added in v1.1.16
func PostNoBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PostNoBody post 请求
func PutFormBody ¶ added in v1.1.16
func PutFormBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PutFormBody put form 请求
func PutJSONBody ¶ added in v1.1.16
func PutJSONBody(url string, raw json.RawMessage, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PutJSONBody put json 请求
func PutNoBody ¶ added in v1.1.16
func PutNoBody(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)
PutNoBody put 请求
func QueryEscapePath ¶ added in v1.2.11
func QueryUnescape ¶
Types ¶
type Option ¶
type Option func(*option)
Option 自定义设置http请求
func WithHeader ¶
WithHeader 设置http header,可以调用多次设置多对key-value
func WithQueryForm ¶ added in v1.1.16
WithQueryForm 添加queryform(仅对 PostWithBody PutWithBody PatchWithBody 有效)
func WithRetryDelay ¶
WithRetryDelay 在重试前,延迟等待一会
Click to show internal directories.
Click to hide internal directories.