transport

package
v0.0.0-...-4d4c888 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CachedResponse

func CachedResponse(c Cache, req *http.Request) (resp *http.Response, err error)

Types

type Cache

type Cache interface {
	Get(key string) (responseBytes []byte, ok bool)
	Set(key string, responseBytes []byte)
	Delete(key string)
}

type MemoryCache

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

func NewMemoryCache

func NewMemoryCache() *MemoryCache

func (*MemoryCache) Delete

func (c *MemoryCache) Delete(key string)

func (*MemoryCache) Get

func (c *MemoryCache) Get(key string) (resp []byte, ok bool)

func (*MemoryCache) Set

func (c *MemoryCache) Set(key string, resp []byte)

type Transport

type Transport struct {
	Token     string
	Transport http.RoundTripper
	Cache     Cache
	// contains filtered or unexported fields
}

func NewMemoryCacheTransport

func NewMemoryCacheTransport() *Transport

func NewTransport

func NewTransport(c Cache) *Transport

func (*Transport) Client

func (t *Transport) Client() *http.Client

func (*Transport) RoundTrip

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

func (*Transport) SetToken

func (t *Transport) SetToken(token string) *Transport

Jump to

Keyboard shortcuts

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