Skip to main content
Version: 24.38.0

Page.setExtraHTTPHeaders() 方法

🌐 Page.setExtraHTTPHeaders() method

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

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

tip

所有 HTTP 头名称都使用小写。(HTTP 头不区分大小写,因此这不应影响你的服务器代码。)

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

note

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

范围

🌐 Parameter

类型

🌐 Type

描述

🌐 Description

headers

Record<string, string>

一个包含额外 HTTP 头的对象,这些头会随每个请求发送。所有头的值都必须是字符串。

🌐 An object containing additional HTTP headers to be sent with every request. All header values must be strings.

返回:

Promise<void>