transport

package
v0.0.0-...-3371691 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(user, password string, base http.RoundTripper) http.RoundTripper

BasicAuth creates an http transport performing basic auth

func BasicAuthHeader

func BasicAuthHeader(user, password string) string

BasicAuthHeader returns the basic auth header

func BearerAuth

func BearerAuth(token string, base http.RoundTripper) http.RoundTripper

BearerAuth creates an HTTP transport performing HTTP authorization using an OAuth 2.0 Bearer Token

func DecorateHeaders

func DecorateHeaders(headers map[string]string) func(req *http.Request) error

DecorateHeaders wraps the given http.Request with a decorator that adds the given parameters to the request headers.

func DecorateQuery

func DecorateQuery(params map[string]string) func(req *http.Request) error

DecorateQuery wraps the given http.Request with a decorator that adds the given parameters to the GET query string.

func Default

func Default() *http.Transport

Default returns an http.DefaultTransport as http.Transport with reduced dial timeout

func Insecure

func Insecure() *http.Transport

InsecureTransport is an http.Transport with TLSClientConfig.InsecureSkipVerify enabled

Types

type Decorator

type Decorator struct {
	// Decorator modifies the outgoing request
	Decorator func(*http.Request) error

	// Base is the base RoundTripper used to make HTTP requests.
	// If nil, http.DefaultTransport is used.
	Base http.RoundTripper
}

Decorator is an http.RoundTripper that makes HTTP requests, wrapping a base RoundTripper and modifying given base requests.

func (*Decorator) RoundTrip

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

RoundTrip decorates the request using the Decorator.

Jump to

Keyboard shortcuts

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