Skip to content

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

fix(client-certificates): error response body Content-Length calculation (#31897)

Max Schmittcc313f329036
diff --git a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
index f16a60fe00..cd78c11e40 100644
--- a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
+++ b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts
@@ -201,7 +201,7 @@ class SocksProxyConnection {
'HTTP/1.1 503 Internal Server Error',
'Content-Type: text/html; charset=utf-8',
'Content-Length: ' + Buffer.byteLength(responseBody),
- '\r\n',
+ '',
responseBody,
].join('\r\n'));
closeBothSockets();
diff --git a/tests/library/client-certificates.spec.ts b/tests/library/client-certificates.spec.ts
index 9f055a678b..f6192248ef 100644
--- a/tests/library/client-certificates.spec.ts
+++ b/tests/library/client-certificates.spec.ts
@@ -274,7 +274,7 @@ test.describe('browser', () => {
}],
});
await page.goto(browserName === 'webkit' && platform === 'darwin' ? httpsServer.EMPTY_PAGE.replace('localhost', 'local.playwright') : httpsServer.EMPTY_PAGE);
- await expect(page.getByText('Playwright client-certificate error')).toBeVisible();
+ await expect(page.getByText('Playwright client-certificate error: self-signed certificate')).toBeVisible();
await page.close();
});