Documentation ¶
Index ¶
- type AsHeaderer
- type Case
- type ResponseWriter
- func (mrw *ResponseWriter) CheckBody(t *testing.T) bool
- func (mrw *ResponseWriter) CheckHeaders(t *testing.T) bool
- func (mrw *ResponseWriter) CheckStatusCode(t *testing.T) bool
- func (mrw *ResponseWriter) Header() http.Header
- func (mrw *ResponseWriter) Write(b []byte) (int, error)
- func (mrw *ResponseWriter) WriteHeader(statusCode int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsHeaderer ¶
func (AsHeaderer) Header ¶
func (h AsHeaderer) Header() http.Header
type Case ¶
type Case struct { // V is the value to be encode and written to the Responder V interface{} // R is the http.Request object R *http.Request // W is the expected values that should be written W ResponseWriter // Err is the expected error Err error // ErrComparator will be used if defined to compare the errors ErrComparator func(expected, got error) bool }
Case is a test case for a responder
type ResponseWriter ¶
type ResponseWriter struct { // Status is the http status that should be set Status int // Headers that must exist and their values Headers http.Header // Body is the expected body Body io.Reader // StatusCodeComparator will be used to check the status code StatusCodeComparator func(expected, got int) bool // HeadersComparator will be used to check the headers HeaderComparator func(expected, got http.Header) bool // BodyComparator will be used to check the body BodyComparator func(expected, got []byte) bool // contains filtered or unexported fields }
func (*ResponseWriter) CheckHeaders ¶
func (mrw *ResponseWriter) CheckHeaders(t *testing.T) bool
func (*ResponseWriter) CheckStatusCode ¶
func (mrw *ResponseWriter) CheckStatusCode(t *testing.T) bool
func (*ResponseWriter) Header ¶
func (mrw *ResponseWriter) Header() http.Header
func (*ResponseWriter) WriteHeader ¶
func (mrw *ResponseWriter) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.