httpcli

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxContentLength int64 = 1024 * 1024 * 10
)

Variables

View Source
var DefaultTransport http.RoundTripper

Functions

func CopyHeader

func CopyHeader(dst http.Header, src http.Header)

func CtxWithHeader

func CtxWithHeader(ctx context.Context, header http.Header) context.Context

func HeaderCtxValue added in v0.1.0

func HeaderCtxValue(ctx context.Context) http.Header

func NewRoundTripper

func NewRoundTripper(cfg *TransportOptions) (http.RoundTripper, error)

Types

type Client

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

Client ...

func NewClient

func NewClient(rt http.RoundTripper) *Client

NewClient ...

func (*Client) Do

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

Do ...

func (*Client) DoAndRead added in v0.1.0

func (c *Client) DoAndRead(req *http.Request) ([]byte, error)

func (*Client) DoWithReader added in v0.1.0

func (c *Client) DoWithReader(req *http.Request, br io.ReaderFrom) error

type TransportOptions

type TransportOptions struct {
	MaxIdleConnsPerHost   int
	InsecureSkipVerify    bool
	DisableHTTP2          bool
	DialTimeout           time.Duration
	ResponseHeaderTimeout time.Duration
	IdleConnTimeout       time.Duration
	ReadIdleTimeout       time.Duration
	PingTimeout           time.Duration
}

Jump to

Keyboard shortcuts

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