A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/node-fetch/node-fetch/commit/8bc3a7c85f67fb81bb3d71c8254e68f3b88e9169 below:

socket variable testing for undefined (#1726) · node-fetch/node-fetch@8bc3a7c · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+5

-2

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+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