alwayscache

package module
v0.0.0-...-d5e91ed Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 4 Imported by: 0

README

alwayscache is a Go HTTP transport to always cache the response in-memory.

It's intended for testing and development, not production use. I clobbered this because I got tired of waiting for the Stripe API when developing an integration with it.

Usage:

client = http.Client{
    Timeout:   10 * time.Second,
    Transport: alwayscache.NewTransport(),
}

Documentation

Overview

Package alwayscache is a HTTP transport to always caches the response in memory.

It's intended for testing and development, not production use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transport

type Transport struct {
	Transport http.RoundTripper
}

Transport behaves like http.RoundTripper, but will always return the body from an in-memory cache whenever possible.

func NewTransport

func NewTransport() *Transport

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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