Documentation ¶
Index ¶
- type MockServer
- func (c *MockServer) Close()
- func (c *MockServer) Cookie(cookies []*http.Cookie)
- func (c *MockServer) Do(t *testing.T, path string, method string, body io.Reader) *Response
- func (c *MockServer) FormData(t *testing.T, path string, method string, form *contents.Multipart) *Response
- func (c *MockServer) Get(t *testing.T, path string) *Response
- func (c *MockServer) GetOK(t *testing.T, path string) *Response
- func (c *MockServer) Post(t *testing.T, path string, contentType string, body io.Reader) *Response
- func (c *MockServer) PostForm(t *testing.T, path string, value url.Values) *Response
- func (c *MockServer) PostFormData(t *testing.T, path string, form *contents.Multipart) *Response
- func (c *MockServer) PostJson(t *testing.T, path string, obj any) *Response
- func (c *MockServer) PostString(t *testing.T, path string, contentType string, body string) *Response
- func (c *MockServer) URL(path string) string
- type Response
- func (c *Response) Body() *bytes.Buffer
- func (c *Response) EqBody(t *testing.T, body string)
- func (c *Response) EqJson(t *testing.T, obj any)
- func (c *Response) Json(v any) error
- func (c *Response) Ok(t *testing.T)
- func (c *Response) SetCookies() []*http.Cookie
- func (c *Response) Status(t *testing.T, status int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockServer ¶
func NewMockTLSServer ¶
func NewMockTLSServer(handler http.Handler) *MockServer
Start mock server with TLS mode
func (*MockServer) Cookie ¶
func (c *MockServer) Cookie(cookies []*http.Cookie)
func (*MockServer) FormData ¶
func (c *MockServer) FormData(t *testing.T, path string, method string, form *contents.Multipart) *Response
multipart/form-data
func (*MockServer) GetOK ¶
func (c *MockServer) GetOK(t *testing.T, path string) *Response
Get Request and check status 200
func (*MockServer) PostFormData ¶
POST multipart/form-data
func (*MockServer) PostString ¶
type Response ¶
func NewResponse ¶
func (*Response) SetCookies ¶ added in v1.1.2
Returns set-cookie's
Click to show internal directories.
Click to hide internal directories.