From 08789d7c34feb6fa948c7fc6fd28ab2d5fc291da Mon Sep 17 00:00:00 2001 From: Artem Derevnjuk Date: Mon, 6 Nov 2023 23:11:48 +0400 Subject: [PATCH] fix: align Node.js and ECMAScript versions (#496) For details please refer to https://node.green/ --- src/Archive/Validators/HarValidator.ts | 2 +- src/RequestExecutor/Request.ts | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Archive/Validators/HarValidator.ts b/src/Archive/Validators/HarValidator.ts index 3989a4f8..c4a489c1 100644 --- a/src/Archive/Validators/HarValidator.ts +++ b/src/Archive/Validators/HarValidator.ts @@ -47,7 +47,7 @@ export class HarValidator implements Validator { .map(this.parseEntry, this) .filter((item: string) => !!item); - const targets: string[] = [...new Set(urls).values()]; + const targets: string[] = [...new Set(urls)]; return targets.length !== 0; } diff --git a/src/RequestExecutor/Request.ts b/src/RequestExecutor/Request.ts index 86c0bf0b..317b71e6 100644 --- a/src/RequestExecutor/Request.ts +++ b/src/RequestExecutor/Request.ts @@ -123,16 +123,17 @@ export class Request { ...headers }; - this._headers = Object.fromEntries( - Object.entries(mergedHeaders).map( - ([field, value]: [string, string | string[]]) => [ - field, + this._headers = Object.entries(mergedHeaders).reduce( + (result, [field, value]: [string, string | string[]]) => { + result[field] = Array.isArray(value) && Request.SINGLE_VALUE_HEADERS.has(field.toLowerCase()) ? value.join(', ') - : value - ] - ) + : value; + + return result; + }, + {} ); }