Documentation ¶
Overview ¶
Package servertest 针对 server 的测试用例
Index ¶
- func BuildHandler(code int) server.HandlerFunc
- func NewServer(a *assert.Assertion, o *server.Options) *server.Server
- type Tester
- func (s *Tester) Close(shutdown time.Duration)
- func (s *Tester) Delete(path string) *rest.Request
- func (s *Tester) Get(path string) *rest.Request
- func (s *Tester) GoServe()
- func (s *Tester) NewRequest(method, path string, client *http.Client) *rest.Request
- func (s *Tester) NewRouter(ms ...server.Middleware) *server.Router
- func (s *Tester) Server() *server.Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHandler ¶
func BuildHandler(code int) server.HandlerFunc
BuildHandler 生成以 code 作为状态码和内容输出的路由处理函数
Types ¶
type Tester ¶
type Tester struct {
// contains filtered or unexported fields
}
func (*Tester) NewRequest ¶
NewRequest 发起新的请求
path 为请求路径,如果没有 `http://` 和 `https://` 前缀,则会自动加上 `http://localhost“ 作为其域名地址; client 如果为空,则采用 &http.Client{} 作为默认值;
Click to show internal directories.
Click to hide internal directories.