-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Open
Labels
C-nodejsJavaScript BindingsJavaScript BindingsI-defectSomething is not working as intendedSomething is not working as intended
Description
Description
ProvideResponseParameters.headers()
calls header.asMap()
, but the Header
class in the Node binding doesn’t implement asMap()
, so you hit TypeError: header.asMap is not a function
. (You can see the call in bidi/provideResponseParameters.js
and the Header
class definition in bidi/networkTypes.js
.)
TypeError: header.asMap is not a function
at /Users/ankianan/repos/ehrc-e2e-tests/tests/e2e-ui-tests/node_modules/selenium-webdriver/bidi/provideResponseParameters.js:80:49
Reproducible Code
/* eslint-disable @typescript-eslint/no-var-requires */
const { ProvideResponseParameters } = require('selenium-webdriver/bidi/provideResponseParameters');
const { BytesValue, Header } = require('selenium-webdriver/bidi/networkTypes.js');
const bufferStr = Buffer.from(JSON.stringify({})).toString("base64");
// Use Buffer.byteLength for accurate header byte count
const byteLength = Buffer.byteLength(bufferStr);
// Provide headers as Header instances using BytesValue
const headers = [
new Header("content-type", new BytesValue("string", "application/json")),
new Header("access-control-allow-methods", new BytesValue("string", "*")),
new Header("access-control-allow-origin", new BytesValue("string", "*")),
new Header("content-length", new BytesValue("string", byteLength.toString())),
];
// Use "base64" encoding for body, wrapped in BytesValue
const body = new BytesValue("base64", bufferStr);
new ProvideResponseParameters(1)
.statusCode(200)
.body(body)
.headers(headers)
.reasonPhrase("OK");
Metadata
Metadata
Assignees
Labels
C-nodejsJavaScript BindingsJavaScript BindingsI-defectSomething is not working as intendedSomething is not working as intended