httpclient

package
v0.0.0-...-7a3883e Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryDurationFactor = 5
)

Constants

Variables

This section is empty.

Functions

func HTTPGet

func HTTPGet(queryURL string, params *map[string]string, options ...ClientOption) ([]byte, error)

HTTPGet request

func HTTPGetJSON

func HTTPGetJSON(queryURL string, params *map[string]string, options ...ClientOption) (map[string]interface{}, error)

HTTPGetJSON request and response as json

func HTTPGetJSONList

func HTTPGetJSONList(queryURL string, params *map[string]interface{}, options ...ClientOption) ([]byte, error)

HTTPGetJSONList request get json value list

func HTTPPostJSON

func HTTPPostJSON(queryURL string, params map[string]interface{}, options ...ClientOption) (map[string]interface{}, error)

HTTPPostJSON request and response as json

func HTTPPostJSONEx

func HTTPPostJSONEx(queryURL string, params interface{}, result interface{}, options ...ClientOption) error

HTTPPostJSONEx request and response as json

func HTTPQuery

func HTTPQuery(method string, queryURL string, body io.Reader, options ...ClientOption) ([]byte, error)

HTTPQuery request

func HTTPURLRequestWithoutBody

func HTTPURLRequestWithoutBody(method string, queryURL string, params *map[string]interface{}, options ...ClientOption) ([]byte, error)

HTTPURLRequestWithoutBody URL parameter transfer without body

Types

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption http client option

func WithHTTPHeader

func WithHTTPHeader(name, value string) ClientOption

WithHTTPHeader options

func WithHTTPHeaders

func WithHTTPHeaders(headers map[string]string) ClientOption

WithHTTPHeaders options

func WithHTTPHeadersEx

func WithHTTPHeadersEx(headers map[string]interface{}) ClientOption

WithHTTPHeadersEx options

func WithHTTPProxies

func WithHTTPProxies(proxies *definations.Proxies) ClientOption

WithHTTPProxies options

func WithHTTPTLSOptions

func WithHTTPTLSOptions(tlsOptions *definations.TLSOptions) ClientOption

WithHTTPTLSOptions options

func WithRetry

func WithRetry(shouldRetryTimes int) ClientOption

WithRetry options

func WithSuccessStatusCodes

func WithSuccessStatusCodes(codes ...int) ClientOption

WithSuccessStatusCodes options

func WithTimeout

func WithTimeout(timeoutSeconds int) ClientOption

WithTimeout options

Jump to

Keyboard shortcuts

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