Add a workaround to POST /window W3C call
MODIFY
lib/jsonwp-proxy/protocol-converter.js
lib/jsonwp-proxy/protocol-converter.js
@@ -129,12 +129,18 @@ class ProtocolConverter {
const bodyObj = util.safeJsonParse(body);
if (_.isPlainObject(bodyObj)) {
if (this.downstreamProtocol === W3C && _.has(bodyObj, 'name') && !_.has(bodyObj, 'handle')) {
- log.debug(`Reassigned 'name' value '${bodyObj.name}' to 'handle' as per W3C spec`);
- return await this.proxyFunc(url, method, {handle: bodyObj.name});
+ log.debug(`Copied 'name' value '${bodyObj.name}' to 'handle' as per W3C spec`);
+ return await this.proxyFunc(url, method, {
+ ...bodyObj,
+ handle: bodyObj.name,
+ });
}
if (this.downstreamProtocol === MJSONWP && _.has(bodyObj, 'handle') && !_.has(bodyObj, 'name')) {
- log.debug(`Reassigned 'handle' value '${bodyObj.handle}' to 'name' as per JSONWP spec`);
- return await this.proxyFunc(url, method, {name: bodyObj.handle});
+ log.debug(`Copied 'handle' value '${bodyObj.handle}' to 'name' as per JSONWP spec`);
+ return await this.proxyFunc(url, method, {
+ ...bodyObj,
+ name: bodyObj.handle,
+ });
}
}

Add a workaround to POST /window W3C call (#335)