Skip to content

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

fix: postDataJSON without Content-Type header (#29918)

Max Schmittb158e4ef9678
diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.ts
index 4bd7698016..f58048655e 100644
--- a/packages/playwright-core/src/client/network.ts
+++ b/packages/playwright-core/src/client/network.ts
@@ -141,7 +141,7 @@ export class Request extends ChannelOwner<channels.RequestChannel> implements ap
return null;
const contentType = this.headers()['content-type'];
- if (contentType.includes('application/x-www-form-urlencoded')) {
+ if (contentType?.includes('application/x-www-form-urlencoded')) {
const entries: Record<string, string> = {};
const parsed = new URLSearchParams(postData);
for (const [k, v] of parsed.entries())