From 41511c1deb905f3ab59ce80e1838a0ab83bf8a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Parker?= Date: Wed, 25 Nov 2020 23:03:52 +0100 Subject: [PATCH] fix(headers): use for...of instead of forEach --- .changeset/selfish-cameras-sort.md | 5 +++++ packages/eapi-middleware-headers/src/withHeaders.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/selfish-cameras-sort.md diff --git a/.changeset/selfish-cameras-sort.md b/.changeset/selfish-cameras-sort.md new file mode 100644 index 0000000..d96bf41 --- /dev/null +++ b/.changeset/selfish-cameras-sort.md @@ -0,0 +1,5 @@ +--- +'@p-j/eapi-middleware-headers': patch +--- + +replace headers.forEach by for...of headers.entries() diff --git a/packages/eapi-middleware-headers/src/withHeaders.ts b/packages/eapi-middleware-headers/src/withHeaders.ts index 747d9aa..0a95635 100644 --- a/packages/eapi-middleware-headers/src/withHeaders.ts +++ b/packages/eapi-middleware-headers/src/withHeaders.ts @@ -75,7 +75,7 @@ export function manageHeaders({ if (addHeaders) { const headers = new Headers(addHeaders) - headers.forEach((value, header) => { + for (let [header, value] of headers.entries()) { const values = parseHeaderValues(value) const originalValues = parseHeaderValues(subject.headers.get(header) || '') @@ -98,7 +98,7 @@ export function manageHeaders({ break } } - }) + } } removeHeaders.forEach((header) => subject.headers.delete(header))