fxhttpclient

package
v0.0.0-...-4ef61cc Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHeadersToForward = []string{
	"authorization",
	"x-request-id",
	"traceparent",
}

Functions

This section is empty.

Types

type HttpClient

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

func NewCtxHttpClient

func NewCtxHttpClient(ctx context.Context, opts ...HttpClientOption) *HttpClient

func (*HttpClient) CloseIdleConnections

func (c *HttpClient) CloseIdleConnections()

func (*HttpClient) Do

func (c *HttpClient) Do(req *http.Request) (*http.Response, error)

func (*HttpClient) Get

func (c *HttpClient) Get(url string) (resp *http.Response, err error)

func (*HttpClient) Head

func (c *HttpClient) Head(url string) (resp *http.Response, err error)

func (*HttpClient) Post

func (c *HttpClient) Post(url, contentType string, body io.Reader) (resp *http.Response, err error)

func (*HttpClient) PostForm

func (c *HttpClient) PostForm(url string, data url.Values) (resp *http.Response, err error)

type HttpClientOption

type HttpClientOption func(o *options)

func WithCheckRedirect

func WithCheckRedirect(f func(req *http.Request, via []*http.Request) error) HttpClientOption

func WithCookieJar

func WithCookieJar(j http.CookieJar) HttpClientOption

func WithRequestHeadersToForward

func WithRequestHeadersToForward(req *http.Request, headersNames []string) HttpClientOption

func WithTimeout

func WithTimeout(t time.Duration) HttpClientOption

func WithTransport

func WithTransport(t http.RoundTripper) HttpClientOption

Jump to

Keyboard shortcuts

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