有奖捉虫:办公协同&微信生态&物联网文档专题 HOT

Properties(属性)

basicAuth

OptionalbasicAuth: BasicAuth basicAuth http 基础鉴权。

body

Optionalbody: string|object|ArrayBuffer body 是要发送的请求体。只有当使用 do 方法时才需要指定。

contentLength

OptionalcontentLength: number contentLength 记录关联内容的长度。 -1:表示长度未知。>= 0:表示可以从 body 中读取给定的字节数。

discardResponseBody

OptionaldiscardResponseBody: boolean discardResponseBody 丢弃响应体,适用于响应体太大且不需要对响应体内容进行 check 的场景。

headers

Optionalheaders: Record<string, string> headers 包含由客户端发送的请求头字段。

host

Optionalhost: string host 或者 host:port。

maxRedirects

OptionalmaxRedirects: number maxRedirects 重定向跳转次数。

method

Optionalmethod: string method 指定 HTTP 方法(GET、POST、PUT 等)。只有当使用 do 方法时才需要指定。

path

Optionalpath: string path 表示路径(相对路径省略前导斜杠)。

query

Optionalquery: Record<string, string> query 是与请求一起发送的 URL 参数。

scheme

Optionalscheme: `"http"`|`"https"` scheme 协议 http/https。

service

Optionalservice: string service 在 PTS 中,我们按照 url 来识别不同 service,基于 serivce 纬度生成报表。当 url 中包含参数: http://demo.com/{id},不同的 id 将导致请求在报表中被归类为不同的服务。或者每个 url 含有不同的 ip port 的时候也会被归类为不同的服务。您可通过指定 service,将此类请求在报表中归类到同一个服务下。

timeout

Optionaltimeout: number timeout 指定此客户端发出的请求的时间限制。 超时包括连接时间、任何重定向和读取响应正文。单位毫秒。

url

Optionalurl: string url 指定要访问的 URL。只有当使用 do 方法时才需要指定。

Methods

chunked Optionalchunked(body): void chunked 当数据以一系列分块的形式进行发送时,如果指定了 chunked 函数,会按行读取响应体,每次读取到响应体之后回调 chunked 函数。

Parameters

Name
Type
body
string
Returnsvoid