Skip to content

Commit

Permalink
fix: legacy compat
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Jun 22, 2020
1 parent dd68fe5 commit e5ec7ea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/client-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,16 @@ function write (client, {
if (chunked) {
socket.write(`\r\n${Buffer.byteLength(chunk).toString(16)}\r\n`, 'ascii')
}
if (!socket.write(chunk)) {
if (!socket.write(chunk) && body.pause) {
body.pause()
}
}
const onDrain = () => {
body.resume()
// TODO (fix): Improve test coverage.
/* istanbul ignore else */
if (body.resume) {
body.resume()
}
}
const onAbort = () => {
onFinished(new RequestAbortedError())
Expand Down Expand Up @@ -713,6 +717,8 @@ function write (client, {
body.destroy(err)
}

// TODO (fix): Improve test coverage.
/* istanbul ignore else */
if (!socket.destroyed) {
assert(client.running)
socket.destroy(err)
Expand Down

0 comments on commit e5ec7ea

Please sign in to comment.