decorator

package
v0.0.0-...-b631e0d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decorate

func Decorate(t http.RoundTripper, rts ...Decorator) http.RoundTripper

Decorate is a helper to wrap all the middleware

func Exec

func Exec() error

Exec creates a client, calls google.com then prints the response

func Setup

func Setup() *http.Client

Setup initializes our ClientInterface

Types

type Decorator

type Decorator func(http.RoundTripper) http.RoundTripper

Decorator is a convenience function to represent our middleware inner function

func BasicAuth

func BasicAuth(username, password string) Decorator

BasicAuth is another of our 'middleware' decorators

func Logger

func Logger(l *log.Logger) Decorator

Logger is one of our 'middleware' decorators

type TransportFunc

type TransportFunc func(*http.Request) (*http.Response, error)

TransportFunc implements the RountTripper interface

func (TransportFunc) RoundTrip

func (tf TransportFunc) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip just calls the original function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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