uhttp

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 82

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx context.Context, options ...Option) (*http.Client, error)

NewClient creates a new HTTP client that uses the given context and options to create a new transport layer.

Types

type Option

type Option interface {
	Apply(*Transport)
}

func WithLogger

func WithLogger(log bool, logger *zap.Logger) Option

WithLogger sets a logger options to the transport layer.

func WithTLSClientConfig

func WithTLSClientConfig(tlsConfig *tls.Config) Option

WithTLSClientConfig returns an Option that sets the TLS client configuration. `tlsConfig` is a structure that is used to configure a TLS client or server.

func WithUserAgent

func WithUserAgent(userAgent string) Option

WithUserAgent sets a user agent option to the transport layer.

type Transport

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

func NewTransport

func NewTransport(ctx context.Context, options ...Option) (*Transport, error)

NewTransport creates a new Transport, applies the options, and then cycles the transport.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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