httpstub

package module
v0.3.31 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	SetClient(http.Client)
}

Client is the minimum interface needed to intercept requests for a http.Client obj Specially good fit with structs wrapping http.Client

type Receive added in v0.3.1

type Receive struct {
	Body   []byte
	Params url.Values
}

type Stub

type Stub struct {
	URL string

	Status int
	Body   interface{}

	Config  StubConfig
	Receive Receive
}

Stub is any single request stub

type StubConfig added in v0.3.1

type StubConfig struct {
	DontAssertReceive bool
}

type Stubber

type Stubber struct {
	Stubs  []*Stub
	Client Client
	Config StubberConfig
}

func (*Stubber) Router

func (s *Stubber) Router(t *testing.T) http.Handler

func (*Stubber) Serve

func (s *Stubber) Serve(t *testing.T) (Close func())

type StubberConfig added in v0.3.1

type StubberConfig struct {
	DontAssertUnstubbed bool
}

Jump to

Keyboard shortcuts

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