Versions in this module Expand all Collapse all v1 v1.4.9 Jul 9, 2020 Changes in this version + const ConsumerName + const SystemUnderTestDefaultName + type APITest struct + func New(name ...string) *APITest + func (a *APITest) Debug() *APITest + func (a *APITest) Delete(url string) *Request + func (a *APITest) EnableNetworking(cli ...*http.Client) *APITest + func (a *APITest) Get(url string) *Request + func (a *APITest) Handler(handler http.Handler) *APITest + func (a *APITest) HandlerFunc(handlerFunc http.HandlerFunc) *APITest + func (a *APITest) HttpClient(cli *http.Client) *APITest + func (a *APITest) Intercept(interceptor Intercept) *APITest + func (a *APITest) Meta(meta map[string]interface{}) *APITest + func (a *APITest) Method(method string) *Request + func (a *APITest) Mocks(mocks ...*Mock) *APITest + func (a *APITest) Observe(observers ...Observe) *APITest + func (a *APITest) ObserveMocks(observer Observe) *APITest + func (a *APITest) Patch(url string) *Request + func (a *APITest) Post(url string) *Request + func (a *APITest) Put(url string) *Request + func (a *APITest) Recorder(recorder *Recorder) *APITest + func (a *APITest) RecorderHook(hook RecorderHook) *APITest + func (a *APITest) Report(reporter ReportFormatter) *APITest + func (a *APITest) Request() *Request + func (a *APITest) Response() *Response + func (a *APITest) Verifier(v Verifier) *APITest + type Assert func(*http.Response, *http.Request) error + var IsClientError Assert = func(response *http.Response, request *http.Request) error { ... } + var IsServerError Assert = func(response *http.Response, request *http.Request) error { ... } + var IsSuccess Assert = func(response *http.Response, request *http.Request) error { ... } + type Cookie struct + func FromHTTPCookie(httpCookie *http.Cookie) *Cookie + func NewCookie(name string) *Cookie + func (cookie *Cookie) Domain(domain string) *Cookie + func (cookie *Cookie) Expires(expires time.Time) *Cookie + func (cookie *Cookie) HttpOnly(httpOnly bool) *Cookie + func (cookie *Cookie) MaxAge(maxAge int) *Cookie + func (cookie *Cookie) Path(path string) *Cookie + func (cookie *Cookie) Secure(secure bool) *Cookie + func (cookie *Cookie) ToHttpCookie() *http.Cookie + func (cookie *Cookie) Value(value string) *Cookie + type Event interface + GetTime func() time.Time + type FinalResponse struct + type HttpRequest struct + Source string + Target string + Timestamp time.Time + Value *http.Request + func (r HttpRequest) GetTime() time.Time + type HttpResponse struct + Source string + Target string + Timestamp time.Time + Value *http.Response + func (r HttpResponse) GetTime() time.Time + type InboundRequest struct + type Intercept func(*http.Request) + type Matcher func(*http.Request, *MockRequest) error + type MessageRequest struct + Body string + Header string + Source string + Target string + Timestamp time.Time + func (r MessageRequest) GetTime() time.Time + type MessageResponse struct + Body string + Header string + Source string + Target string + Timestamp time.Time + func (r MessageResponse) GetTime() time.Time + type Mock struct + func NewMock() *Mock + func (m *Mock) Debug() *Mock + func (m *Mock) Delete(u string) *MockRequest + func (m *Mock) Get(u string) *MockRequest + func (m *Mock) Head(u string) *MockRequest + func (m *Mock) HttpClient(cli *http.Client) *Mock + func (m *Mock) Matches(req *http.Request) []error + func (m *Mock) Method(method string) *MockRequest + func (m *Mock) Patch(u string) *MockRequest + func (m *Mock) Post(u string) *MockRequest + func (m *Mock) Put(u string) *MockRequest + type MockRequest struct + func (r *MockRequest) AddMatcher(matcher Matcher) *MockRequest + func (r *MockRequest) BasicAuth(username, password string) *MockRequest + func (r *MockRequest) Body(b string) *MockRequest + func (r *MockRequest) BodyFromFile(f string) *MockRequest + func (r *MockRequest) Cookie(name, value string) *MockRequest + func (r *MockRequest) CookieNotPresent(name string) *MockRequest + func (r *MockRequest) CookiePresent(name string) *MockRequest + func (r *MockRequest) FormData(key string, values ...string) *MockRequest + func (r *MockRequest) FormDataNotPresent(key string) *MockRequest + func (r *MockRequest) FormDataPresent(key string) *MockRequest + func (r *MockRequest) Header(key, value string) *MockRequest + func (r *MockRequest) HeaderNotPresent(key string) *MockRequest + func (r *MockRequest) HeaderPresent(key string) *MockRequest + func (r *MockRequest) Headers(headers map[string]string) *MockRequest + func (r *MockRequest) Query(key, value string) *MockRequest + func (r *MockRequest) QueryCollection(queryParams map[string][]string) *MockRequest + func (r *MockRequest) QueryNotPresent(key string) *MockRequest + func (r *MockRequest) QueryParams(queryParams map[string]string) *MockRequest + func (r *MockRequest) QueryPresent(key string) *MockRequest + func (r *MockRequest) RespondWith() *MockResponse + type MockResponse struct + func (r *MockResponse) Body(body string) *MockResponse + func (r *MockResponse) BodyFromFile(f string) *MockResponse + func (r *MockResponse) Cookie(name, value string) *MockResponse + func (r *MockResponse) Cookies(cookie ...*Cookie) *MockResponse + func (r *MockResponse) End() *Mock + func (r *MockResponse) EndStandalone(other ...*Mock) func() + func (r *MockResponse) Header(key string, value string) *MockResponse + func (r *MockResponse) Headers(headers map[string]string) *MockResponse + func (r *MockResponse) Status(statusCode int) *MockResponse + func (r *MockResponse) Times(times int) *MockResponse + type NoopVerifier struct + func (n NoopVerifier) Equal(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) bool + func (n NoopVerifier) Fail(t *testing.T, failureMessage string, msgAndArgs ...interface{}) bool + func (n NoopVerifier) JSONEq(t *testing.T, expected string, actual string, msgAndArgs ...interface{}) bool + func (n NoopVerifier) NoError(t *testing.T, err error, msgAndArgs ...interface{}) bool + type Observe func(*http.Response, *http.Request, *APITest) + type Recorder struct + Events []Event + Meta map[string]interface{} + SubTitle string + Title string + func NewTestRecorder() *Recorder + func (r *Recorder) AddHttpRequest(req HttpRequest) *Recorder + func (r *Recorder) AddHttpResponse(req HttpResponse) *Recorder + func (r *Recorder) AddMessageRequest(m MessageRequest) *Recorder + func (r *Recorder) AddMessageResponse(m MessageResponse) *Recorder + func (r *Recorder) AddMeta(meta map[string]interface{}) *Recorder + func (r *Recorder) AddSubTitle(subTitle string) *Recorder + func (r *Recorder) AddTitle(title string) *Recorder + func (r *Recorder) Reset() + func (r *Recorder) ResponseStatus() (int, error) + type RecorderHook func(*Recorder) + type ReportFormatter interface + Format func(*Recorder) + type Request struct + func (r *Request) BasicAuth(username, password string) *Request + func (r *Request) Body(b string) *Request + func (r *Request) BodyFromFile(f string) *Request + func (r *Request) ContentType(contentType string) *Request + func (r *Request) Cookie(name, value string) *Request + func (r *Request) Cookies(c ...*Cookie) *Request + func (r *Request) Expect(t *testing.T) *Response + func (r *Request) FormData(name string, values ...string) *Request + func (r *Request) Header(key, value string) *Request + func (r *Request) Headers(headers map[string]string) *Request + func (r *Request) JSON(v interface{}) *Request + func (r *Request) JSONFromFile(f string) *Request + func (r *Request) Query(key, value string) *Request + func (r *Request) QueryCollection(q map[string][]string) *Request + func (r *Request) QueryParams(params map[string]string) *Request + func (r *Request) URL(url string) *Request + type Response struct + func (r *Response) Assert(fn func(*http.Response, *http.Request) error) *Response + func (r *Response) Body(b string) *Response + func (r *Response) BodyFromFile(f string) *Response + func (r *Response) Cookie(name, value string) *Response + func (r *Response) CookieNotPresent(cookieName string) *Response + func (r *Response) CookiePresent(cookieName string) *Response + func (r *Response) Cookies(cookies ...*Cookie) *Response + func (r *Response) End() Result + func (r *Response) Header(key, value string) *Response + func (r *Response) HeaderNotPresent(name string) *Response + func (r *Response) HeaderPresent(name string) *Response + func (r *Response) Headers(headers map[string]string) *Response + func (r *Response) Status(s int) *Response + type Result struct + Response *http.Response + func (r Result) JSON(t interface{}) + type SequenceDiagramFormatter struct + func SequenceDiagram(path ...string) *SequenceDiagramFormatter + func (r *SequenceDiagramFormatter) Format(recorder *Recorder) + type StandaloneMocks struct + func NewStandaloneMocks(mocks ...*Mock) *StandaloneMocks + func (r *StandaloneMocks) Debug() *StandaloneMocks + func (r *StandaloneMocks) End() func() + func (r *StandaloneMocks) HttpClient(cli *http.Client) *StandaloneMocks + type Transport struct + func (r *Transport) Hijack() + func (r *Transport) Reset() + func (r *Transport) RoundTrip(req *http.Request) (mockResponse *http.Response, matchErrors error) + type Verifier interface + Equal func(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) bool + Fail func(t *testing.T, failureMessage string, msgAndArgs ...interface{}) bool + JSONEq func(t *testing.T, expected string, actual string, msgAndArgs ...interface{}) bool + NoError func(t *testing.T, err error, msgAndArgs ...interface{}) bool