Skip to content

Commit 78d2621

Browse files
committed
fix: stream termination
1 parent bca3c31 commit 78d2621

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

fetch/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @web-std/node-fetch
1+
# @web-std/fetch
22

33
[![ci][ci.icon]][ci.url]
44
[![package][version.icon] ![downloads][downloads.icon]][package.url]

fetch/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default async function fetch(url, options_ = {}) {
102102
});
103103

104104
fixResponseChunkedTransferBadEnding(request_, err => {
105-
response.body.cancel(err);
105+
response_.emit('error', err);
106106
});
107107

108108
/* c8 ignore next 18 */
@@ -119,7 +119,7 @@ export default async function fetch(url, options_ = {}) {
119119
if (response && endedWithEventsCount < s._eventsCount && !hadError) {
120120
const err = new Error('Premature close');
121121
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
122-
response.body.cancel(err);
122+
response_.emit('error', err);
123123
}
124124
});
125125
});

0 commit comments

Comments
 (0)