Documentation ¶
Index ¶
- func NewMultiRouteServer(routeResponseOptions map[Route][]ResponseRuleOption) (*httptest.Server, map[Route]*RequestRecorder)
- type Body
- type RequestRecorder
- func (r RequestRecorder) AssertFormParamEqual(t *testing.T, formParamName string, formValues []string) bool
- func (r RequestRecorder) AssertHeaderContains(t *testing.T, expectedHeader http.Header) bool
- func (r RequestRecorder) AssertJSONBodyEqual(t *testing.T, expectedBody interface{}) bool
- func (r RequestRecorder) AssertNoRequest(t *testing.T) bool
- func (r RequestRecorder) AssertParamEqual(t *testing.T, paramName, paramValue string) bool
- func (r RequestRecorder) AssertQueryParamEqual(t *testing.T, queryParamName string, queryParamValues []string) bool
- func (r RequestRecorder) AssertStringBodyEqual(t *testing.T, expectedBody string) bool
- func (r RequestRecorder) AssertXMLBodyEqual(t *testing.T, expectedXMLBody interface{}) bool
- type RequestRecorderBinder
- type ResponseRuleOption
- func ByteBody(b []byte) ResponseRuleOption
- func CorruptedBody() ResponseRuleOption
- func Header(header http.Header) ResponseRuleOption
- func JSONBody(body interface{}) ResponseRuleOption
- func StatusCode(statusCode int) ResponseRuleOption
- func StringBody(str string) ResponseRuleOption
- func Timeout(duration time.Duration) ResponseRuleOption
- func XMLBody(body interface{}) ResponseRuleOption
- type Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMultiRouteServer ¶
func NewMultiRouteServer(routeResponseOptions map[Route][]ResponseRuleOption) (*httptest.Server, map[Route]*RequestRecorder)
Types ¶
type RequestRecorder ¶
type RequestRecorder struct { Body Body Header http.Header Data []byte Params map[string]string QueryParams url.Values FormParams url.Values // contains filtered or unexported fields }
func NewRequestRecorder ¶
func NewRequestRecorder() *RequestRecorder
func NewServer ¶
func NewServer(httpMethod, path string, responseRuleOptions ...ResponseRuleOption) (*httptest.Server, *RequestRecorder)
func (RequestRecorder) AssertFormParamEqual ¶
func (RequestRecorder) AssertHeaderContains ¶
func (RequestRecorder) AssertJSONBodyEqual ¶
func (r RequestRecorder) AssertJSONBodyEqual(t *testing.T, expectedBody interface{}) bool
func (RequestRecorder) AssertNoRequest ¶
func (r RequestRecorder) AssertNoRequest(t *testing.T) bool
func (RequestRecorder) AssertParamEqual ¶
func (r RequestRecorder) AssertParamEqual(t *testing.T, paramName, paramValue string) bool
func (RequestRecorder) AssertQueryParamEqual ¶
func (RequestRecorder) AssertStringBodyEqual ¶
func (r RequestRecorder) AssertStringBodyEqual(t *testing.T, expectedBody string) bool
func (RequestRecorder) AssertXMLBodyEqual ¶
func (r RequestRecorder) AssertXMLBodyEqual(t *testing.T, expectedXMLBody interface{}) bool
type RequestRecorderBinder ¶
type RequestRecorderBinder struct{}
type ResponseRuleOption ¶
type ResponseRuleOption func(*responseRule)
func ByteBody ¶
func ByteBody(b []byte) ResponseRuleOption
func CorruptedBody ¶
func CorruptedBody() ResponseRuleOption
func Header ¶
func Header(header http.Header) ResponseRuleOption
func JSONBody ¶
func JSONBody(body interface{}) ResponseRuleOption
func StatusCode ¶
func StatusCode(statusCode int) ResponseRuleOption
func StringBody ¶
func StringBody(str string) ResponseRuleOption
func Timeout ¶
func Timeout(duration time.Duration) ResponseRuleOption
func XMLBody ¶
func XMLBody(body interface{}) ResponseRuleOption
Click to show internal directories.
Click to hide internal directories.