testutil

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParseURL

func MustParseURL(urlstr string) *url.URL

func NewBody

func NewBody(s string) io.ReadCloser

func NewHTTPRouter

func NewHTTPRouter(t *testing.T) *httpstub.Router

NewHTTPRouter returns a new test HTTP router

func ReadBody

func ReadBody(r io.ReadCloser) string

Types

type AllCache

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

func NewAllCache

func NewAllCache(t testing.TB) *AllCache

func (*AllCache) Hit

func (c *AllCache) Hit() int

func (*AllCache) Load

func (c *AllCache) Load(req *http.Request) (*http.Request, *http.Response, error)

func (*AllCache) Store

func (c *AllCache) Store(req *http.Request, res *http.Response, expires time.Time) error

type Cacher

type Cacher interface {
	Load(req *http.Request) (cachedReq *http.Request, cachedRes *http.Response, err error)
	Store(req *http.Request, res *http.Response, expires time.Time) error
	Hit() int
}

type GetOnlyCache

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

func NewGetOnlyCache

func NewGetOnlyCache(t testing.TB) *GetOnlyCache

func (*GetOnlyCache) Hit

func (c *GetOnlyCache) Hit() int

func (*GetOnlyCache) Load

func (c *GetOnlyCache) Load(req *http.Request) (*http.Request, *http.Response, error)

func (*GetOnlyCache) Store

func (c *GetOnlyCache) Store(req *http.Request, res *http.Response, expires time.Time) error

Jump to

Keyboard shortcuts

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