httpclient

package
v0.0.0-...-f0b8264 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	Client      *http.Client
	RetryConfig *HTTPRetryConfig
}

func NewHTTPClient

func NewHTTPClient(config *HTTPClientConfig) (*HTTPClient, error)

func (*HTTPClient) DoHttpRequest

func (c *HTTPClient) DoHttpRequest(ctx context.Context, req *PushRequest) (*PushResponse, error)

type HTTPClientConfig

type HTTPClientConfig struct {
	ProxyConfig *HTTPProxyConfig
	RetryConfig *HTTPRetryConfig
}

func NewHTTPClientConfig

func NewHTTPClientConfig(c *config.Config) (*HTTPClientConfig, error)

type HTTPOption

type HTTPOption func(r *http.Request)

func SetHeader

func SetHeader(key string, value string) HTTPOption

type HTTPProxyConfig

type HTTPProxyConfig struct {
	ProxyUrl        *url.URL
	ProxyCACertPath string
}

type HTTPRetryConfig

type HTTPRetryConfig struct {
	MaxRetryTimes int
	RetryInterval time.Duration
}

type PushRequest

type PushRequest struct {
	Method string
	URL    string
	Body   []byte
	Header []HTTPOption
}

type PushResponse

type PushResponse struct {
	Status int
	Header http.Header
	Body   []byte
}

Jump to

Keyboard shortcuts

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