testclient

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BasePath string
	Body     io.Reader
	Query    url.Values

	Tripperwares tripperware.List
}

Config :

func (*Config) Copy

func (c *Config) Copy() *Config

Copy :

type FakeClient added in v0.2.0

type FakeClient struct {
	Handler http.Handler
}

FakeClient :

func (*FakeClient) Do added in v0.2.0

func (c *FakeClient) Do(
	req *http.Request,
	config *Config,
) (Response, error)

Do :

func (*FakeClient) NewRequest added in v0.2.0

func (c *FakeClient) NewRequest(
	method string,
	path string,
	config *Config,
) (*http.Request, error)

NewRequest :

func (*FakeClient) RoundTrip added in v0.2.0

func (c *FakeClient) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip :

type RealClient added in v0.2.0

type RealClient struct {
	URL    string
	Client *http.Client
}

RealClient :

func (*RealClient) Do added in v0.2.0

func (c *RealClient) Do(
	req *http.Request,
	config *Config,
) (Response, error)

Do :

func (*RealClient) NewRequest added in v0.2.0

func (c *RealClient) NewRequest(
	method string,
	path string,
	config *Config,
) (*http.Request, error)

NewRequest :

type Response

type Response interface {
	io.Closer

	Code() int
	Header() http.Header
	Request() *http.Request

	Raw() *http.Response

	// // Extractor :
	// type Extractor interface {
	ParseJSONData(val interface{}) error
	JSONData() interface{}

	Body() []byte
	Text() string
	LazyText() fmt.Stringer
}

Response :

type ResponseAdapter

type ResponseAdapter struct {
	GetResponse func() *http.Response
	// contains filtered or unexported fields
}

ResponseAdapter :

func NewResponseAdapter

func NewResponseAdapter(get func() *http.Response) *ResponseAdapter

NewResponseAdapter :

func (*ResponseAdapter) AddTeardown

func (res *ResponseAdapter) AddTeardown(fn func() error)

func (*ResponseAdapter) Body

func (res *ResponseAdapter) Body() []byte

Body :

func (*ResponseAdapter) Buffer

func (res *ResponseAdapter) Buffer() *bytes.Buffer

Buffer : (TODO: rename)

func (*ResponseAdapter) Close

func (res *ResponseAdapter) Close() error

Close :

func (*ResponseAdapter) Code

func (res *ResponseAdapter) Code() int

Code :

func (*ResponseAdapter) Header added in v0.3.0

func (res *ResponseAdapter) Header() http.Header

Header :

func (*ResponseAdapter) JSONData

func (res *ResponseAdapter) JSONData() interface{}

JSONData :

func (*ResponseAdapter) LazyText

func (res *ResponseAdapter) LazyText() fmt.Stringer

LazyText :

func (*ResponseAdapter) ParseJSONData

func (res *ResponseAdapter) ParseJSONData(val interface{}) error

ParseJSONData :

func (*ResponseAdapter) Raw added in v0.3.0

func (res *ResponseAdapter) Raw() *http.Response

Raw :

func (*ResponseAdapter) Request added in v0.3.0

func (res *ResponseAdapter) Request() *http.Request

Request :

func (*ResponseAdapter) Text

func (res *ResponseAdapter) Text() string

Text :

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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