From d13c88e70de9b3fd61c526ead90716fac503deed Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Mon, 3 Oct 2022 13:34:13 +0200 Subject: refactor(ext/fetch): avoid extra headers copy in .clone (#16130) --- ext/fetch/23_request.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ext/fetch/23_request.js') diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js index 5221d5ca9..508a29139 100644 --- a/ext/fetch/23_request.js +++ b/ext/fetch/23_request.js @@ -35,7 +35,6 @@ ObjectKeys, ObjectPrototypeIsPrototypeOf, RegExpPrototypeTest, - SafeArrayIterator, Symbol, SymbolFor, TypeError, @@ -159,11 +158,11 @@ * @returns {InnerRequest} */ function cloneInnerRequest(request) { - const headerList = [ - ...new SafeArrayIterator( - ArrayPrototypeMap(request.headerList, (x) => [x[0], x[1]]), - ), - ]; + const headerList = ArrayPrototypeMap( + request.headerList, + (x) => [x[0], x[1]], + ); + let body = null; if (request.body !== null) { body = request.body.clone(); -- cgit v1.2.3