# Functions
BuildHandler 生成用于测试的 [http.Handler] 对象
仅是简单地按以下步骤输出内容: - 输出状态码 code; - 输出报头 headers,以 Add 方式,而不是 set,不会覆盖原来的数据; - 输出 body,如果为空字符串,则不会输出;.
No description provided by the author
No description provided by the author
No description provided by the author
NewRequest 以调用链的方式构建一个访问请求对象.
NewServer 声明新的测试服务
如果 client 为 nil,则会采用 &http.Client{} 作为默认值.
NewTLSServer 声明新的测试服务
如果 client 为 nil,则会采用 &http.Client{} 作为默认值.
No description provided by the author
No description provided by the author
No description provided by the author
RawHandler 通过原始数据进行比较请求和返回数据是符合要求
功能上与 RawHTTP 相似,处理方式从 http.Client 变成了 http.Handler。.
RawHTTP 通过原始数据进行比较请求和返回数据是符合要求
reqRaw 表示原始的请求数据。其格式如下:
POST https://example.com/path HTTP/1.1
text
会忽略 HOST 报头,而是应该将主机部分直接写在请求地址中。
respRaw 表示返回之后的原始数据;
NOTE: 仅判断状态码、报头和实际内容是否相同,而不是直接比较两个 http.Response 的值。.