Skip to content

Commit 1c5ed6b

Browse files
authored
fix: undefined reference to response.body when aborted (node-fetch#1578)
1 parent a92b5d5 commit 1c5ed6b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ export default async function fetch(url, options_) {
110110
});
111111

112112
fixResponseChunkedTransferBadEnding(request_, error => {
113-
response.body.destroy(error);
113+
if (response && response.body) {
114+
response.body.destroy(error);
115+
}
114116
});
115117

116118
/* c8 ignore next 18 */

0 commit comments

Comments
 (0)