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: 0

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