Skip to content

Commit

Permalink
fix(headers): use for...of instead of forEach
Browse files Browse the repository at this point in the history
  • Loading branch information
p-j committed Nov 25, 2020
1 parent 28470bc commit 41511c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-cameras-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@p-j/eapi-middleware-headers': patch
---

replace headers.forEach by for...of headers.entries()
4 changes: 2 additions & 2 deletions packages/eapi-middleware-headers/src/withHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) || '')

Expand All @@ -98,7 +98,7 @@ export function manageHeaders({
break
}
}
})
}
}

removeHeaders.forEach((header) => subject.headers.delete(header))
Expand Down

0 comments on commit 41511c1

Please # to comment.