chore(webdriver): fix sending multiple headers (#12170)

This commit is contained in:
Nikolay Vitkov 2024-03-27 20:10:41 +01:00 committed by GitHub
parent bc5af0fcf1
commit 730221d98d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -272,13 +272,17 @@ function getBidiHeaders(rawHeaders?: Record<string, unknown>) {
const headers: Bidi.Network.Header[] = [];
for (const [name, value] of Object.entries(rawHeaders ?? [])) {
if (!Object.is(value, undefined)) {
headers.push({
name: name.toLowerCase(),
value: {
type: 'string',
value: String(value),
},
});
const values = Array.isArray(value) ? value : [value];
for (const value of values) {
headers.push({
name: name.toLowerCase(),
value: {
type: 'string',
value: String(value),
},
});
}
}
}