Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: undeprecate sync headers() (#15152)

Pavel Feldman8c590cb2af92
diff --git a/docs/src/api/class-request.md b/docs/src/api/class-request.md
index d414f00954..5afca6492b 100644
--- a/docs/src/api/class-request.md
+++ b/docs/src/api/class-request.md
@@ -59,7 +59,9 @@ Returns the [Frame] that initiated this request.
## method: Request.headers
- returns: <[Object]<[string], [string]>>
-**DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use [`method: Request.allHeaders`] instead.
+An object with the request HTTP headers. The header names are lower-cased.
+Note that this method does not return security-related headers, including cookie-related ones.
+You can use [`method: Request.allHeaders`] for complete list of headers that include `cookie` information.
## async method: Request.headersArray
- returns: <[Array]<[Object]>>
diff --git a/docs/src/api/class-response.md b/docs/src/api/class-response.md
index 550ffe5240..016a575813 100644
--- a/docs/src/api/class-response.md
+++ b/docs/src/api/class-response.md
@@ -30,7 +30,9 @@ Indicates whether this Response was fullfilled by a Service Worker's Fetch Handl
## method: Response.headers
- returns: <[Object]<[string], [string]>>
-**DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use [`method: Response.allHeaders`] instead.
+An object with the response HTTP headers. The header names are lower-cased.
+Note that this method does not return security-related headers, including cookie-related ones.
+You can use [`method: Response.allHeaders`] for complete list of headers that include `cookie` information.
## async method: Response.headersArray
- returns: <[Array]<[Object]>>
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index 6fdaa75deb..112ec34bdf 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -14858,9 +14858,10 @@ export interface Request {
frame(): Frame;
/**
- * **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use
- * [request.allHeaders()](https://playwright.dev/docs/api/class-request#request-all-headers) instead.
- * @deprecated
+ * An object with the request HTTP headers. The header names are lower-cased. Note that this method does not return
+ * security-related headers, including cookie-related ones. You can use
+ * [request.allHeaders()](https://playwright.dev/docs/api/class-request#request-all-headers) for complete list of headers
+ * that include `cookie` information.
*/
headers(): { [key: string]: string; };
@@ -15095,9 +15096,10 @@ export interface Response {
fromServiceWorker(): boolean;
/**
- * **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use
- * [response.allHeaders()](https://playwright.dev/docs/api/class-response#response-all-headers) instead.
- * @deprecated
+ * An object with the response HTTP headers. The header names are lower-cased. Note that this method does not return
+ * security-related headers, including cookie-related ones. You can use
+ * [response.allHeaders()](https://playwright.dev/docs/api/class-response#response-all-headers) for complete list of
+ * headers that include `cookie` information.
*/
headers(): { [key: string]: string; };