Documentation ¶
Index ¶
- func NewMockServer(rec MockRecorder, procedures ...MockServerProcedure) *httptest.Server
- type MockAssertion
- func (m *MockAssertion) Body(uri, method string) [][]byte
- func (m *MockAssertion) Headers(uri, method string) []http.Header
- func (m *MockAssertion) Hits(uri, method string) int
- func (m *MockAssertion) Record(r *http.Request)
- func (m *MockAssertion) Reset() error
- func (m *MockAssertion) URL(uri, method string) (urlList []*url.URL)
- type MockRecorder
- type MockResponse
- type MockServerProcedure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMockServer ¶
func NewMockServer(rec MockRecorder, procedures ...MockServerProcedure) *httptest.Server
NewMockServer return a mock HTTP server to test requests
Types ¶
type MockAssertion ¶
type MockAssertion struct {
// contains filtered or unexported fields
}
MockAssertion represents a common assertion for requests
func (*MockAssertion) Body ¶
func (m *MockAssertion) Body(uri, method string) [][]byte
Body returns request body
func (*MockAssertion) Headers ¶
func (m *MockAssertion) Headers(uri, method string) []http.Header
Headers returns a slice of request headers
func (*MockAssertion) Hits ¶
func (m *MockAssertion) Hits(uri, method string) int
Hits returns the number of hits for a uri and method
func (*MockAssertion) Record ¶
func (m *MockAssertion) Record(r *http.Request)
Record records request hit information
func (*MockAssertion) Reset ¶
func (m *MockAssertion) Reset() error
Reset sets all unexpected properties to their zero value
type MockRecorder ¶
MockRecorder provides a way to record request information from every successful request.
type MockResponse ¶
type MockResponse struct { StatusCode int Headers http.Header Body []byte BodyFn func() []byte HeaderFn func() http.Header }
MockResponse represents a response for the mock server to serve
type MockServerProcedure ¶
type MockServerProcedure struct { URI string HTTPMethod string Response MockResponse ResponseFn func() MockResponse }
Click to show internal directories.
Click to hide internal directories.