httpclient

package
v0.0.0-...-e8da0a6 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHttpResponseError

func CheckHttpResponseError(resp *http.Response) error

func DefaultURL

func DefaultURL(url string, defaultTLS bool) (*neturl.URL, error)

func RetryableHttpErrorHandler

func RetryableHttpErrorHandler(resp *http.Response, err error, numTries int) (*http.Response, error)

func ValidateURL

func ValidateURL(url string) error

Types

type HttpClient

type HttpClient struct {
	// contains filtered or unexported fields
}

func NewHttpClient

func NewHttpClient(address string, defaultTLS bool, retryMax, retryInterval int) (*HttpClient, error)

func (*HttpClient) Delete

func (c *HttpClient) Delete(path string) *Request

func (*HttpClient) Get

func (c *HttpClient) Get(path string) *Request

func (*HttpClient) Post

func (c *HttpClient) Post(path string) *Request

func (*HttpClient) Put

func (c *HttpClient) Put(path string) *Request

func (*HttpClient) SetDisableKeepAlives

func (c *HttpClient) SetDisableKeepAlives()

func (*HttpClient) SetTLSInsecureSkipVerify

func (c *HttpClient) SetTLSInsecureSkipVerify()

type Request

type Request struct {
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(c *HttpClient, method, reqPath string) *Request

func (*Request) AddHeader

func (r *Request) AddHeader(key, value string) *Request

func (*Request) Do

func (r *Request) Do(ctx context.Context) Result

func (*Request) GetMethod

func (r *Request) GetMethod() string

func (*Request) SetBody

func (r *Request) SetBody(bodyType string, body []byte) *Request

func (*Request) SetGzip

func (r *Request) SetGzip(b bool) *Request

func (*Request) SetHeader

func (r *Request) SetHeader(key, value string) *Request

func (*Request) SetParam

func (r *Request) SetParam(key string, values ...string) *Request

func (*Request) SetParamFromQuery

func (r *Request) SetParamFromQuery(query url.Values) *Request

func (*Request) ShallowCopy

func (r *Request) ShallowCopy() *Request

func (*Request) URL

func (r *Request) URL() *url.URL

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (Result) Error

func (r Result) Error() error

func (Result) Headers

func (r Result) Headers() http.Header

func (Result) IntoJson

func (r Result) IntoJson(obj interface{}) error

func (Result) Raw

func (r Result) Raw() ([]byte, error)

func (Result) SetError

func (r Result) SetError(err error) Result

func (Result) StatusCode

func (r Result) StatusCode() int

Jump to

Keyboard shortcuts

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