mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
refactor(ext/fetch): avoid extra headers copy in .clone (#16130)
This commit is contained in:
parent
7a7767262a
commit
d13c88e70d
2 changed files with 10 additions and 11 deletions
|
@ -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();
|
||||
|
|
|
@ -97,11 +97,11 @@
|
|||
*/
|
||||
function cloneInnerResponse(response) {
|
||||
const urlList = [...new SafeArrayIterator(response.urlList)];
|
||||
const headerList = [
|
||||
...new SafeArrayIterator(
|
||||
ArrayPrototypeMap(response.headerList, (x) => [x[0], x[1]]),
|
||||
),
|
||||
];
|
||||
const headerList = ArrayPrototypeMap(
|
||||
response.headerList,
|
||||
(x) => [x[0], x[1]],
|
||||
);
|
||||
|
||||
let body = null;
|
||||
if (response.body !== null) {
|
||||
body = response.body.clone();
|
||||
|
|
Loading…
Reference in a new issue