Documentation
¶
Index ¶
Constants ¶
View Source
const ( //ContentTypeJSON string associated with content-type json ContentTypeJSON = "application/json" //ContentTypeHTML string associated with content-type html ContentTypeHTML = "text/html" )
Variables ¶
This section is empty.
Functions ¶
func CheckErr ¶
func CheckErr(tassert *assert.Assertions, wantErr bool, err error)
CheckErr checks if function returned error correctly
func EncodeJSON ¶
EncodeJSON encodes json data in bytes
Types ¶
type ExpectedResponse ¶
type ExpectedResponse struct {
StatusCode int
ResponseType ContentType
Body interface{}
}
ExpectedResponse stores expected responce basic data
type HTTPTest ¶
type HTTPTest struct {
*assert.Assertions
Encoder func(interface{}) ([]byte, error)
}
HTTPTest encapsulates data for testing needs
func (*HTTPTest) CompareHTTPResponse ¶
func (test *HTTPTest) CompareHTTPResponse(rr *httptest.ResponseRecorder, expected ExpectedResponse)
CompareHTTPResponse compares expected responce with real one
Click to show internal directories.
Click to hide internal directories.