Documentation ¶
Index ¶
- Variables
- func StubbedBody() io.ReadCloser
- func StubbedResponseWriter() http.ResponseWriter
- type BodyMock
- type ClientMock
- func (c *ClientMock) Do(req *http.Request) (*http.Response, error)
- func (c *ClientMock) HandleFunc(path string, handler func(http.ResponseWriter, *http.Request))
- func (c *ClientMock) ListenAndServe(addr string, handler http.Handler) error
- func (c *ClientMock) NewRequest(method, url string, body io.Reader) (*http.Request, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultMockFn = func(req *http.Request) (*http.Response, error) { res := &http.Response{} res.Body = StubbedBody() return res, nil }
View Source
var HandlerStubFn = func(in string, handler func(w http.ResponseWriter, r *http.Request)) {}
View Source
var MockFn = DefaultMockFn
View Source
var NewRequestStubFn = func(method, url string, body io.Reader) (*http.Request, error) { return http.NewRequest(method, url, body) }
Functions ¶
func StubbedBody ¶
func StubbedBody() io.ReadCloser
func StubbedResponseWriter ¶
func StubbedResponseWriter() http.ResponseWriter
Types ¶
type ClientMock ¶
type ClientMock struct{}
func (*ClientMock) HandleFunc ¶
func (c *ClientMock) HandleFunc(path string, handler func(http.ResponseWriter, *http.Request))
func (*ClientMock) ListenAndServe ¶
func (c *ClientMock) ListenAndServe(addr string, handler http.Handler) error
func (*ClientMock) NewRequest ¶
Click to show internal directories.
Click to hide internal directories.