From bc5af0fcf1f44d28801ee230fd499cf5e704d33d Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Wed, 27 Mar 2024 19:43:09 +0100 Subject: [PATCH] chore(webdriver): fix issues when removing header (#12167) --- packages/puppeteer-core/src/bidi/HTTPRequest.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/puppeteer-core/src/bidi/HTTPRequest.ts b/packages/puppeteer-core/src/bidi/HTTPRequest.ts index 090fe2764e9..c65f25fc099 100644 --- a/packages/puppeteer-core/src/bidi/HTTPRequest.ts +++ b/packages/puppeteer-core/src/bidi/HTTPRequest.ts @@ -271,13 +271,15 @@ export class BidiHTTPRequest extends HTTPRequest { function getBidiHeaders(rawHeaders?: Record) { const headers: Bidi.Network.Header[] = []; for (const [name, value] of Object.entries(rawHeaders ?? [])) { - headers.push({ - name: name.toLowerCase(), - value: { - type: 'string', - value: String(value), - }, - }); + if (!Object.is(value, undefined)) { + headers.push({ + name: name.toLowerCase(), + value: { + type: 'string', + value: String(value), + }, + }); + } } return headers;