mirror of
https://github.com/denoland/deno.git
synced 2025-01-12 00:54:02 -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,
|
ObjectKeys,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
RegExpPrototypeTest,
|
RegExpPrototypeTest,
|
||||||
SafeArrayIterator,
|
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -159,11 +158,11 @@
|
||||||
* @returns {InnerRequest}
|
* @returns {InnerRequest}
|
||||||
*/
|
*/
|
||||||
function cloneInnerRequest(request) {
|
function cloneInnerRequest(request) {
|
||||||
const headerList = [
|
const headerList = ArrayPrototypeMap(
|
||||||
...new SafeArrayIterator(
|
request.headerList,
|
||||||
ArrayPrototypeMap(request.headerList, (x) => [x[0], x[1]]),
|
(x) => [x[0], x[1]],
|
||||||
),
|
);
|
||||||
];
|
|
||||||
let body = null;
|
let body = null;
|
||||||
if (request.body !== null) {
|
if (request.body !== null) {
|
||||||
body = request.body.clone();
|
body = request.body.clone();
|
||||||
|
|
|
@ -97,11 +97,11 @@
|
||||||
*/
|
*/
|
||||||
function cloneInnerResponse(response) {
|
function cloneInnerResponse(response) {
|
||||||
const urlList = [...new SafeArrayIterator(response.urlList)];
|
const urlList = [...new SafeArrayIterator(response.urlList)];
|
||||||
const headerList = [
|
const headerList = ArrayPrototypeMap(
|
||||||
...new SafeArrayIterator(
|
response.headerList,
|
||||||
ArrayPrototypeMap(response.headerList, (x) => [x[0], x[1]]),
|
(x) => [x[0], x[1]],
|
||||||
),
|
);
|
||||||
];
|
|
||||||
let body = null;
|
let body = null;
|
||||||
if (response.body !== null) {
|
if (response.body !== null) {
|
||||||
body = response.body.clone();
|
body = response.body.clone();
|
||||||
|
|
Loading…
Reference in a new issue