Skip to main content
Version: 23.2.0

Page.setExtraHTTPHeaders() 方法

¥Page.setExtraHTTPHeaders() method

额外的 HTTP 标头将随页面发起的每个请求一起发送。

¥The extra HTTP headers will be sent with every request the page initiates.

提示

所有 HTTP 标头名称均为小写。(HTTP 标头不区分大小写,因此这不会影响你的服务器代码。)

¥All HTTP header names are lowercased. (HTTP headers are case-insensitive, so this shouldn’t impact your server code.)

注意

page.setExtraHTTPHeaders 不保证传出请求中标头的顺序。

¥page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing requests.

签名

¥Signature

class Page {
abstract setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
}

参数

¥Parameters

范围

类型

描述

headers

记录<字符串,字符串>

包含随每个请求发送的附加 HTTP 标头的对象。所有标头值都必须是字符串。

Returns:

Promise<void>