From 0f274ef8177068da65e50e08607998d0ed63e8b9 Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Fri, 23 Feb 2024 16:49:14 +0300 Subject: [PATCH] enhance(utils/getHeadersObj): prevent `ownKeys` trap to return the same keys --- .changeset/eighty-beds-allow.md | 5 +++++ packages/utils/src/getHeadersObj.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/eighty-beds-allow.md diff --git a/.changeset/eighty-beds-allow.md b/.changeset/eighty-beds-allow.md new file mode 100644 index 0000000000000..e7211ca670d97 --- /dev/null +++ b/.changeset/eighty-beds-allow.md @@ -0,0 +1,5 @@ +--- +"@graphql-mesh/utils": patch +--- + +Prevent `ownKeys` trap to return the same keys diff --git a/packages/utils/src/getHeadersObj.ts b/packages/utils/src/getHeadersObj.ts index 553121789cd30..48d40e36fafbe 100644 --- a/packages/utils/src/getHeadersObj.ts +++ b/packages/utils/src/getHeadersObj.ts @@ -28,7 +28,7 @@ export function getHeadersObj( return headers.has(name.toString().toLowerCase()); }, ownKeys(_target) { - return [...headers.keys()]; + return [...new Set(headers.keys())]; }, set(_target, name, value) { headers.set(name.toString().toLowerCase(), value);