summaryrefslogtreecommitdiff
path: root/op_crates/fetch/23_request.js
diff options
context:
space:
mode:
authorWilliam Perron <hey@wperron.io>2021-04-29 13:56:59 -0400
committerGitHub <noreply@github.com>2021-04-29 13:56:59 -0400
commita50dab683f0d902bcfab53ac5a351c661d816354 (patch)
tree09a7cc9a7240a87abacda11a4809f859364e7383 /op_crates/fetch/23_request.js
parent0ac2a17a0fdb19672058c7e6449c686e2a18366e (diff)
fix(op_crate/fetch): infinite loop on fill headers (#10406)
Fixes a pesky bug in the fetch implementation where if the init part is specified in `fetch` instead of the `Request` constructor, the fillHeaders function receives two references to the same object, causing it to append to the same list being iterated over.
Diffstat (limited to 'op_crates/fetch/23_request.js')
-rw-r--r--op_crates/fetch/23_request.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/op_crates/fetch/23_request.js b/op_crates/fetch/23_request.js
index 0e4bd2a3f..603a37a5f 100644
--- a/op_crates/fetch/23_request.js
+++ b/op_crates/fetch/23_request.js
@@ -247,11 +247,14 @@
// 31.
if (Object.keys(init).length > 0) {
- let headers = headerListFromHeaders(this[_headers]);
+ let headers = headerListFromHeaders(this[_headers]).slice(
+ 0,
+ headerListFromHeaders(this[_headers]).length,
+ );
if (init.headers !== undefined) {
headers = init.headers;
}
- headerListFromHeaders(this[_headers]).slice(
+ headerListFromHeaders(this[_headers]).splice(
0,
headerListFromHeaders(this[_headers]).length,
);