+5
-2
lines changedFilter options
+5
-2
lines changed Original file line number Diff line number Diff line change
@@ -362,8 +362,11 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
362
362
const {headers} = response;
363
363
if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
364
364
response.once('close', hadError => {
365
-
// if a data listener is still present we didn't end cleanly
366
-
const hasDataListener = socket.listenerCount('data') > 0;
365
+
// tests for socket presence, as in some situations the
366
+
// the 'socket' event is not triggered for the request
367
+
// (happens in deno), avoids `TypeError`
368
+
// if a data listener is still present we didn't end cleanly
369
+
const hasDataListener = socket && socket.listenerCount('data') > 0;
367
370
368
371
if (hasDataListener && !hadError) {
369
372
const err = new Error('Premature close');
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4