httpclient

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 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 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)

Types

type Option

type Option func(*option)

func WithContext

func WithContext(ctx context.Context) 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 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

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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