Documentation ¶
Overview ¶
Package rest 简单的 API 测试库
Index ¶
- type Request
- type Response
- func (resp *Response) Body(val []byte, msg ...interface{}) *Response
- func (resp *Response) BodyNil(msg ...interface{}) *Response
- func (resp *Response) BodyNotNil(msg ...interface{}) *Response
- func (resp *Response) Fail(msg ...interface{}) *Response
- func (resp *Response) Header(key string, val string, msg ...interface{}) *Response
- func (resp *Response) JSONBody(val interface{}) *Response
- func (resp *Response) NotHeader(key string, val string, msg ...interface{}) *Response
- func (resp *Response) NotStatus(status int, msg ...interface{}) *Response
- func (resp *Response) Status(status int, msg ...interface{}) *Response
- func (resp *Response) StringBody(val string, msg ...interface{}) *Response
- func (resp *Response) Success(msg ...interface{}) *Response
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request 请求的参数封装
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response 测试请求的返回结构
func (*Response) BodyNotNil ¶
BodyNotNil 报文内容是否不为空
func (*Response) NotStatus ¶
NotStatus 判断状态码是否与 status 不相等,若相等,则返回 msg 指定的消息
msg 可以为空,会返回一个默认的错误提示信息
func (*Response) StringBody ¶
StringBody 报文内容是否与 val 相等
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server 测试服务
func (*Server) NewRequest ¶
NewRequest 获取一条请求的结果
Click to show internal directories.
Click to hide internal directories.