Documentation
¶
Index ¶
- func StartMockServer(dir string, f func(*MockServer))
- type Assert
- type MockServer
- type TestRequest
- func Delete(path string) *TestRequest
- func Get(path string) *TestRequest
- func Post(path string, body string) *TestRequest
- func PostForm(path string, data url.Values) *TestRequest
- func Put(path string, body string) *TestRequest
- func PutForm(path string, data url.Values) *TestRequest
- func Request(method string, path string, body io.Reader) *TestRequest
- type TestResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartMockServer ¶
func StartMockServer(dir string, f func(*MockServer))
Types ¶
type Assert ¶
func (*Assert) HttpBodyString ¶
func (a *Assert) HttpBodyString(expect string, res *TestResponse) *Assert
func (*Assert) HttpHeader ¶
func (a *Assert) HttpHeader(expect string, res *TestResponse, key string) *Assert
func (*Assert) HttpStatus ¶
func (a *Assert) HttpStatus(expect int, res *TestResponse) *Assert
type MockServer ¶
type MockServer struct {
wcg.LocalServer
}
func (*MockServer) BaseUrl ¶
func (ms *MockServer) BaseUrl() string
type TestRequest ¶
func Delete ¶
func Delete(path string) *TestRequest
func Get ¶
func Get(path string) *TestRequest
func Post ¶
func Post(path string, body string) *TestRequest
func Put ¶
func Put(path string, body string) *TestRequest
func (*TestRequest) AddHeader ¶
func (r *TestRequest) AddHeader(key, value string) *TestRequest
func (*TestRequest) Handle ¶
func (t *TestRequest) Handle(funcs ...func(*wcg.Response, *wcg.Request)) *TestResponse
func (*TestRequest) Header ¶
func (t *TestRequest) Header() http.Header
func (*TestRequest) RouteTo ¶
func (t *TestRequest) RouteTo(r *wcg.Router) *TestResponse
type TestResponse ¶
type TestResponse struct { Code int Header http.Header Body []byte Request *TestRequest }
func (*TestResponse) Json ¶
func (t *TestResponse) Json(v interface{}) error
Unmarshal body bytes to JSON object. panic if failes
Click to show internal directories.
Click to hide internal directories.