utils

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpRequest

func HttpRequest(method string, url string, payload interface{}, client *http.Client) (int, []byte, error)

func HttpRequestWithAPIKey

func HttpRequestWithAPIKey(method string, url string, payload interface{}, client *http.Client, key string) (int, []byte, error)

func HttpRequestWithHeader

func HttpRequestWithHeader(method string, url string, payload interface{}, client *http.Client, headers map[string]string) (int, []byte, error)

request will propragate error if the response code is not 2XX

func HttpRequestWithToken

func HttpRequestWithToken(method string, url string, payload interface{}, client *http.Client, token string) (int, []byte, error)

func NewDefaultHttpClient

func NewDefaultHttpClient() *http.Client

func NewHttpClient

func NewHttpClient(config HTTPClientConfig) *http.Client

Types

type HTTPClientConfig

type HTTPClientConfig struct {
	InsecureSkipVerify  bool
	MaxIdleConns        int
	MaxConnsPerHost     int
	MaxIdleConnsPerHost int
	Timeout             time.Duration
}

func NewDefaultHTTPClientConfig

func NewDefaultHTTPClientConfig() *HTTPClientConfig

func NewHTTPClientConfig added in v0.0.4

func NewHTTPClientConfig(insecureSkipVerify bool, maxIdleConns int, maxConnsPerHost int, maxIdleConnsPerHost int, timeout int) *HTTPClientConfig

Jump to

Keyboard shortcuts

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