From 188ac01dab264ed483dbc3b897e6958b49085922 Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Fri, 11 Nov 2022 18:57:16 +0300 Subject: [PATCH] fix(fetch): call the callback on destroy of Readable adapter --- .changeset/sixty-ducks-design.md | 5 +++++ packages/fetch/dist/readableStreamToReadable.js | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/sixty-ducks-design.md diff --git a/.changeset/sixty-ducks-design.md b/.changeset/sixty-ducks-design.md new file mode 100644 index 00000000000..cf129793e3d --- /dev/null +++ b/.changeset/sixty-ducks-design.md @@ -0,0 +1,5 @@ +--- +'@whatwg-node/fetch': patch +--- + +Fix destroy for Node 18 diff --git a/packages/fetch/dist/readableStreamToReadable.js b/packages/fetch/dist/readableStreamToReadable.js index 805ed17895e..3e96b4eb8e7 100644 --- a/packages/fetch/dist/readableStreamToReadable.js +++ b/packages/fetch/dist/readableStreamToReadable.js @@ -12,13 +12,14 @@ module.exports = function readableStreamToReadable(readableStream) { } }) }, - async destroy() { + async destroy(err, callback) { try { reader.cancel(); reader.releaseLock(); await readableStream.cancel(); + callback(); } catch (error) { - console.log(error); + callback(error); } } })