httptesting

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock added in v0.0.2

type Mock struct {
	*httpclient.Client
	// contains filtered or unexported fields
}

func NewMock added in v0.0.2

func NewMock(t *testing.T) *Mock

func (*Mock) NewJSONMatcher added in v0.0.2

func (c *Mock) NewJSONMatcher(body string) httpmock.MatcherFunc

func (*Mock) NewMockRequest added in v0.0.2

func (c *Mock) NewMockRequest(method, url string, params ...httpclient.RequestParameter) *MockRequest

func (*Mock) Transport added in v0.0.2

func (c *Mock) Transport() *httpmock.MockTransport

Transport exposes the httpmock.MockTransport instance for advanced usage.

type MockRequest

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

func (*MockRequest) Register

func (r *MockRequest) Register()

func (*MockRequest) RespondWithHeaders

func (r *MockRequest) RespondWithHeaders(respHeaders map[string]string) *MockRequest

RespondWithHeaders configures the response headers. It can be used multiple times in order to pass different headers. If the header key already exists it will be overwritten.

func (*MockRequest) RespondWithJSON

func (r *MockRequest) RespondWithJSON(statusCode int, body string) *MockRequest

RespondWithJSON will configure a JSON response with the given status code.

func (*MockRequest) Responder

func (r *MockRequest) Responder(resp httpmock.Responder) *MockRequest

Responder provides access to the current responder for inspection or direct operations.

func (*MockRequest) String

func (r *MockRequest) String() string

String provides a representation of the mock request. Only used for debugging purposes.

type MockResponse

type MockResponse httpmock.Responder

Jump to

Keyboard shortcuts

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