httpclient

package
v1.9.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTTL        = time.Second * 10
	DefaultRetryTimes = 3
	DefaultRetryDelay = time.Millisecond * 100
)

Variables

This section is empty.

Functions

func AddFormValuesIntoURL added in v1.5.10

func AddFormValuesIntoURL(rawURL string, form url.Values) (string, error)

func Delete

func Delete(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)

func Get

func Get(url string, form httpURL.Values, options ...Option) (body []byte, header http.Header, statusCode int, err error)

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)

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)

func PatchMultipartFile added in v1.4.0

func PatchMultipartFile(url string, payload [][]byte, options ...Option) (body []byte, header http.Header, statusCode int, err error)

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)

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)

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)

func PostMultipartFile added in v1.4.0

func PostMultipartFile(url string, payload [][]byte, options ...Option) (body []byte, header http.Header, statusCode int, err error)

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)

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)

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)

func PutMultipartFile added in v1.4.0

func PutMultipartFile(url string, payload [][]byte, options ...Option) (body []byte, header http.Header, statusCode int, err error)

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)

func QueryUnescape

func QueryUnescape(uri string) string

Types

type Option

type Option func(*option)

func WithContext

func WithContext(ctx context.Context) Option

func WithDesc added in v1.5.10

func WithDesc(desc string) Option

func WithHeader

func WithHeader(key, value string) Option

func WithJournalID added in v1.5.1

func WithJournalID(id string) Option

WithJournalID set an unique journal id

func WithNonDurableLogger added in v1.5.10

func WithNonDurableLogger(logger *zap.Logger) Option

WithNonDurableLogger record log in external storage

func WithPrintJournal

func WithPrintJournal(logger *zap.Logger, desc string) Option

func WithQueryForm added in v1.1.16

func WithQueryForm(form url.Values) Option

WithQueryForm add some queryform values(only works for with body)

func WithRetryDelay

func WithRetryDelay(retryDelay time.Duration) Option

func WithRetryTimes

func WithRetryTimes(retryTimes int) Option

func WithTTL

func WithTTL(ttl time.Duration) Option

func WithVerifyResponseHandler added in v1.5.10

func WithVerifyResponseHandler(handler VerifyResponseHandler) Option

type VerifyResponseHandler added in v1.5.10

type VerifyResponseHandler func(body []byte) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL