Skip to main content
Version: 23.8.0

HTTPResponse.content() 方法

¥HTTPResponse.content() method

Promise 解析为带有响应正文的缓冲区。

¥Promise which resolves to a buffer with response body.

签名

¥Signature

class HTTPResponse {
abstract content(): Promise<Uint8Array>;
}

Returns:

Promise<Uint8Array>

备注

¥Remarks

浏览器可能会根据 HTTP 标头或其他启发法对缓冲区进行重新编码。如果浏览器无法检测到正确的编码,则缓冲区可能编码不正确。参见 https://github.com/puppeteer/puppeteer/issues/6478

¥The buffer might be re-encoded by the browser based on HTTP-headers or other heuristics. If the browser failed to detect the correct encoding, the buffer might be encoded incorrectly. See https://github.com/puppeteer/puppeteer/issues/6478.