httputil

package
v0.0.0-...-68c1abf Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 8 Imported by: 0

README

httputil

-- import "github.com/rickbassham/example-go/pkg/httputil"

Usage

func APIKeyTransport
func APIKeyTransport(apiKey string, old http.RoundTripper) http.RoundTripper

APIKeyTransport is an http.RoundTripper that will add basic authentication headers to all requests.

func BasicAuthTransport
func BasicAuthTransport(username, password string, old http.RoundTripper) http.RoundTripper

BasicAuthTransport is an http.RoundTripper that will add basic authentication headers to all requests.

func DefaultLogTransport
func DefaultLogTransport(log *zap.Logger, old http.RoundTripper) http.RoundTripper

DefaultLogTransport will add the given logger to all request contexts.

func HeaderTransport
func HeaderTransport(key, value string, old http.RoundTripper) http.RoundTripper

HeaderTransport is an http.RoundTripper that will add a header to all requests.

func LogTransport
func LogTransport(old http.RoundTripper) http.RoundTripper

LogTransport will log every outgoing request.

func TraceIDTransport
func TraceIDTransport(old http.RoundTripper) http.RoundTripper

TraceIDTransport ensures a trace id header is set on all outgoing requests.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKeyTransport

func APIKeyTransport(apiKey string, old http.RoundTripper) http.RoundTripper

APIKeyTransport is an http.RoundTripper that will add basic authentication headers to all requests.

func BasicAuthTransport

func BasicAuthTransport(username, password string, old http.RoundTripper) http.RoundTripper

BasicAuthTransport is an http.RoundTripper that will add basic authentication headers to all requests.

func DefaultLogTransport

func DefaultLogTransport(log *zap.Logger, old http.RoundTripper) http.RoundTripper

DefaultLogTransport will add the given logger to all request contexts.

func HeaderTransport

func HeaderTransport(key, value string, old http.RoundTripper) http.RoundTripper

HeaderTransport is an http.RoundTripper that will add a header to all requests.

func LogTransport

func LogTransport(old http.RoundTripper) http.RoundTripper

LogTransport will log every outgoing request.

func TraceIDTransport

func TraceIDTransport(old http.RoundTripper) http.RoundTripper

TraceIDTransport ensures a trace id header is set on all outgoing requests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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