跳转到主内容

ProtocolResponse 对象

  • error Integer(可选的) - 如果赋值,request将会失败,并返回error错误码。 更多的错误号信息,您可以查阅网络错误列表.
  • statusCode number (可选的) - HTTP响应码,默认是200。
  • charset string (可选) - 响应体的字符集, 默认值为 "utf-8".
  • mimeType string (可选) - MIME 类型的响应正文,默认是 "text/html"。 设置 mimeType 将静默地设置响应头的 content-type。 但如果头部已经设置了 content-typemimeType 将被忽略。
  • headers Record<string, string | string[]> (optional) - An object containing the response headers. 键必须是 string 类型,值必须是 string 或 string 数组。
  • data(Buffer | string | ReadableStream) (可选) - response body。 当以流作为响应返回时,响应体将以Node.js readable stream的形式呈现。 当以 Buffer 作为响应返回时,该属性就是个 Buffer 对象。 当以 string 作为响应返回时,该属性就是一个 string。 其它类型的响应,该属性可被忽略。
  • path string (可选) - 将作为响应体发送的文件的路径。 仅对文件响应生效。
  • url string (可选) - 从该url下载并把结果通过管道作为响应体。 仅对URL响应生效。
  • referrer string (可选) - 引用 URL。 仅对文件和URL响应生效。
  • method string (可选) - HTTP 方法。 仅对文件和URL响应生效。
  • session Session (optional) - The session used for requesting URL. The HTTP request will reuse the current session by default.
  • uploadData ProtocolResponseUploadData (optional) - The data used as upload data. 仅对 方法"POST" 的URL响应生效。