Skip to content

Commit

Permalink
Build sync
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Jul 8, 2023
1 parent 7ec767d commit 3526e6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6546,8 +6546,11 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {

if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
response.once('close', function (hadError) {
// tests for socket presence, as in some situations the
// the 'socket' event is not triggered for the request
// (happens in deno), avoids `TypeError`
// if a data listener is still present we didn't end cleanly
const hasDataListener = socket.listenerCount('data') > 0;
const hasDataListener = socket && socket.listenerCount('data') > 0;

if (hasDataListener && !hadError) {
const err = new Error('Premature close');
Expand Down

0 comments on commit 3526e6f

Please sign in to comment.