servertest

package
v0.84.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package servertest 为 [web.Server] 提供一些简便的测试方

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(a *assert.Assertion, path string) *rest.Request

func Get

func Get(a *assert.Assertion, path string) *rest.Request

func NewRequest

func NewRequest(a *assert.Assertion, method, path string) *rest.Request

NewRequest 发起测试请求

功能与 rest.NewRequest 相同,默认指定了 client 参数。

func Post

func Post(a *assert.Assertion, path string, body []byte) *rest.Request

func Run

func Run(a *assert.Assertion, s Server) func()

Run 运行服务内容并返回等待退出的方法

s 应该始终传递 web.Server 对象。

Types

type Server

type Server interface {
	Serve() error
}

Server 表示 web.Server

因相互引用的原因,此处定义了简要的 web.Server 实现接口。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL