httpclientmdl

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoHTTPWithRetry

func DoHTTPWithRetry(attempts int, sleeptime time.Duration, request *http.Request) (*http.Response, error)

DoHTTPWithRetry for retry support to http request

func GetHTTPClient

func GetHTTPClient() *http.Client

GetHTTPClient This method will return the httpClient object with preconfigured settings

func GetHTTPClientWithConfig

func GetHTTPClientWithConfig(httpTransport HTTPTransport) *http.Client

GetHTTPClientWithConfig This method will return the httpClient object with preconfigured settings

func TryAttempts

func TryAttempts(client *http.Client, request *http.Request, resp *http.Response, err error, attempts int, sleeptime time.Duration) (*http.Response, error)

TryAttempts it retries http get/post request without request body

func TryAttemptsWithRequestBody

func TryAttemptsWithRequestBody(client *http.Client, request *http.Request, resp *http.Response, err error, attempts int, sleeptime time.Duration, bodyBytes []byte) (*http.Response, error)

TryAttemptsWithRequestBody it retries http post request with a request body when failed or gives error

Types

type HTTPTransport

type HTTPTransport struct {
	MaxIdleConns        int
	MaxIdleConnsPerHost int
	IdleConnTimeout     time.Duration
}

Jump to

Keyboard shortcuts

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