uhttp

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 12 Imported by: 1

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 WithDebug

func WithDebug(debug bool) Option

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 WithTokenSource

func WithTokenSource(tokenSource oauth2.TokenSource) Option

WithTokenSource sets a token source option to the transport layer.

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