Documentation ¶
Index ¶
- Variables
- func Exist(object *httpexpect.Object, key string) bool
- func NewWithFileParamFunc(fs []File) paramFunc
- func NewWithJsonParamFunc(query map[string]interface{}) paramFunc
- func NewWithQueryObjectParamFunc(query map[string]interface{}) paramFunc
- func Scan(object *httpexpect.Object, reses ...Responses)
- func Test(value *httpexpect.Value, reses ...interface{})
- type Client
- func (c *Client) DELETE(url string, res interface{}, paramFuncs ...paramFunc)
- func (c *Client) DOWNLOAD(url string, res interface{}, paramFuncs ...paramFunc) string
- func (c *Client) GET(url string, res interface{}, paramFuncs ...paramFunc)
- func (c *Client) Login(url, tokenIndex string, res Responses, paramFuncs ...paramFunc) error
- func (c *Client) Logout(url string, res Responses)
- func (c *Client) POST(url string, res interface{}, paramFuncs ...paramFunc)
- func (c *Client) PUT(url string, res interface{}, paramFuncs ...paramFunc)
- func (c *Client) SetHeaders(headers map[string]string) *Client
- func (c *Client) SetStatus(status int) *Client
- func (c *Client) UPLOAD(url string, res interface{}, paramFuncs ...paramFunc)
- type File
- type Response
- type Responses
- func (rks Responses) GetFloat64(key ...string) float64
- func (res Responses) GetId(key ...string) uint
- func (rks Responses) GetInt(key ...string) int
- func (rks Responses) GetInt32(key ...string) int32
- func (rks Responses) GetResponse(key string) Responses
- func (rks Responses) GetResponses(key string) []Responses
- func (rks Responses) GetStrArray(key string) []string
- func (res Responses) GetString(key ...string) string
- func (rks Responses) GetUint(key ...string) uint
- func (res Responses) Keys() []string
- func (res Responses) Scan(object *httpexpect.Object)
- func (res Responses) Test(value *httpexpect.Value)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // default page request params GetRequestFunc = NewWithQueryObjectParamFunc(map[string]interface{}{"page": 1, "pageSize": 10}) // default page request params PostRequestFunc = NewWithJsonParamFunc(map[string]interface{}{"page": 1, "pageSize": 10}) // default login request params LoginFunc = NewWithJsonParamFunc(map[string]interface{}{"username": "admin", "password": "123456"}) // default login response params LoginResponse = Responses{ {Key: "status", Value: http.StatusOK}, {Key: "message", Value: "OK"}, {Key: "data", Value: Responses{ {Key: "accessToken", Value: "", Type: "notempty"}, }, }, } //LogoutResponse default logout response params LogoutResponse = Responses{ {Key: "status", Value: http.StatusOK}, {Key: "message", Value: "OK"}, } // SuccessResponse default success response params SuccessResponse = Responses{ {Key: "status", Value: http.StatusOK}, {Key: "message", Value: "OK"}, } // ResponsePage default data response params ResponsePage = Responses{ {Key: "status", Value: http.StatusOK}, {Key: "message", Value: "OK"}, {Key: "data", Value: Responses{ {Key: "pageSize", Value: 10}, {Key: "page", Value: 1}, }}, } )
Functions ¶
func NewWithFileParamFunc ¶ added in v0.0.5
func NewWithFileParamFunc(fs []File) paramFunc
NewWithFileParamFunc return req.WithFile
func NewWithJsonParamFunc ¶ added in v0.0.5
func NewWithJsonParamFunc(query map[string]interface{}) paramFunc
NewWithJsonParamFunc return req.WithJSON
func NewWithQueryObjectParamFunc ¶ added in v0.0.5
func NewWithQueryObjectParamFunc(query map[string]interface{}) paramFunc
NewWithQueryObjectParamFunc query for get method
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) SetHeaders ¶ added in v0.1.0
SetHeaders set http request headers
type Response ¶
type Response struct { Type string // httpest type , if empty use Equal() function to test Key string // httptest data's key Value interface{} // httptest data's value Length int // httptest data's length,when the data are array or map Func func(obj interface{}) // httpest func, you can add your test logic ,can be empty }
Response
type Responses ¶
type Responses []Response
Responses
func NewResponses ¶ added in v0.0.6
NewResponses return Responses
func NewResponsesWithLength ¶ added in v0.0.6
NewResponsesWithLength return Responses with length value for data key
func (Responses) GetFloat64 ¶ added in v0.0.6
GetFloat64 return float64
func (Responses) GetResponse ¶
GetResponsereturn Resposnes value
func (Responses) GetResponses ¶
GetResponses return Resposnes Array value
func (Responses) GetStrArray ¶
GetStrArray return string array value.
Click to show internal directories.
Click to hide internal directories.