Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPHandlerTestHelper ¶
type HTTPHandlerTestHelper interface { SetHeader(key, value string) SetForm(key, value string) AddTestCase(testCases ...HandlerTestCase) SetTestCase(testCases ...HandlerTestCase) AddTestCaseFunc(testCases ...HandlerTestCaseFunc) SetTestCaseFunc(testCaseFunc ...HandlerTestCaseFunc) // method Get(urlStr string, testCases ...HandlerTestCaseFunc) Response Head(urlStr string, testCases ...HandlerTestCaseFunc) Response Delete(urlStr string, testCases ...HandlerTestCaseFunc) Response Options(urlStr string, testCases ...HandlerTestCaseFunc) Response Put(urlStr string, bodyType string, body io.Reader, testCases ...HandlerTestCaseFunc) Response Post(urlStr string, bodyType string, body io.Reader, testCases ...HandlerTestCaseFunc) Response }
func New ¶
func New(handler http.Handler) HTTPHandlerTestHelper
type HandlerTestCase ¶
func TestCaseContentLength ¶
func TestCaseContentLength(contentLength int) HandlerTestCase
func TestCaseContentType ¶
func TestCaseContentType(contentType string) HandlerTestCase
func TestCaseStatusCode ¶
func TestCaseStatusCode(statusCode int) HandlerTestCase
type HandlerTestCaseFunc ¶
func (HandlerTestCaseFunc) Execute ¶
func (f HandlerTestCaseFunc) Execute(resp Response) error
Execute calls f(resp) error.
type Response ¶
type Response interface { Error() error String() string Result() (*httptest.ResponseRecorder, error) JSON(v interface{}) error }
func NewErrorResponse ¶
func NewResponse ¶
func NewResponse(resp *httptest.ResponseRecorder) Response
Click to show internal directories.
Click to hide internal directories.