httptest

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpReaderToFile added in v0.3.0

func DumpReaderToFile(r io.Reader, prefix string) io.ReadCloser

func WithConstantFile added in v0.0.1

func WithConstantFile(s string) func(ht *HTTPTest)

WithConstantFile read always the same file

func WithURLToFile added in v0.0.1

func WithURLToFile(fn func(u string) string) func(ht *HTTPTest)

WithURLToFile set the custom function UrlToFile

Types

type HTTPTest added in v0.0.1

type HTTPTest struct {
	UrlToFilefn func(u string) string
}

HTTPTest provides a HTTP getter to mock http requests

func New

func New(conf ...func(ht *HTTPTest)) *HTTPTest

New create a HTTPTest and configures it

func (*HTTPTest) Get added in v0.0.1

func (ht *HTTPTest) Get(u string) (io.ReadCloser, error)

Get implement the Getter interface

func (*HTTPTest) RoundTrip added in v0.0.1

func (ht *HTTPTest) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements the file roundtripper and use the UrlToFile function to determine the actual file name from the given url

Jump to

Keyboard shortcuts

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