Documentation
¶
Index ¶
- type MultipartFile
- type RequestOpt
- type TestResponse
- func (r *TestResponse) AssertContains(text string) *TestResponse
- func (r *TestResponse) AssertJSON(v any) *TestResponse
- func (r *TestResponse) AssertRedirectsTo(path string) *TestResponse
- func (r *TestResponse) AssertSSEEvent(event, data string) *TestResponse
- func (r *TestResponse) AssertStatus(code int) *TestResponse
- type TestServer
- func (s *TestServer) AsUser(userID int64) RequestOpt
- func (s *TestServer) Get(path string, opts ...RequestOpt) *TestResponse
- func (s *TestServer) PostForm(path string, form url.Values, opts ...RequestOpt) *TestResponse
- func (s *TestServer) PostJSON(path string, payload any, opts ...RequestOpt) *TestResponse
- func (s *TestServer) PostMultipart(path string, fields map[string]string, files []MultipartFile, ...) *TestResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultipartFile ¶
type RequestOpt ¶
type RequestOpt func(*requestConfig) error
func WithCookie ¶
func WithCookie(cookie *http.Cookie) RequestOpt
func WithHeader ¶
func WithHeader(key, value string) RequestOpt
type TestResponse ¶
func (*TestResponse) AssertContains ¶
func (r *TestResponse) AssertContains(text string) *TestResponse
func (*TestResponse) AssertJSON ¶
func (r *TestResponse) AssertJSON(v any) *TestResponse
func (*TestResponse) AssertRedirectsTo ¶
func (r *TestResponse) AssertRedirectsTo(path string) *TestResponse
func (*TestResponse) AssertSSEEvent ¶
func (r *TestResponse) AssertSSEEvent(event, data string) *TestResponse
func (*TestResponse) AssertStatus ¶
func (r *TestResponse) AssertStatus(code int) *TestResponse
type TestServer ¶
type TestServer struct {
Server *httptest.Server
Container *shipapp.Container
// contains filtered or unexported fields
}
func NewTestServer ¶
func NewTestServer(t testing.TB) *TestServer
func (*TestServer) AsUser ¶
func (s *TestServer) AsUser(userID int64) RequestOpt
func (*TestServer) Get ¶
func (s *TestServer) Get(path string, opts ...RequestOpt) *TestResponse
func (*TestServer) PostForm ¶
func (s *TestServer) PostForm(path string, form url.Values, opts ...RequestOpt) *TestResponse
func (*TestServer) PostJSON ¶
func (s *TestServer) PostJSON(path string, payload any, opts ...RequestOpt) *TestResponse
func (*TestServer) PostMultipart ¶
func (s *TestServer) PostMultipart(path string, fields map[string]string, files []MultipartFile, opts ...RequestOpt) *TestResponse
Click to show internal directories.
Click to hide internal directories.