Skip to content

Commit

Permalink
fixup: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Feb 16, 2023
1 parent a1c9fc7 commit e259ee6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,13 @@ function emitErrorNt(msg, err, callback) {

function strictContentLength(msg) {
return (
msg._contentLength != null &&
msg.strictContentLength &&
msg._contentLength != null &&
msg._hasBody &&
!msg._removedContLen &&
!msg.chunkedEncoding &&
!msg.hasHeader('transfer-encoding')
)
);
}

function write_(msg, chunk, encoding, callback, fromEnd) {
Expand Down Expand Up @@ -880,7 +880,9 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength : null;

if (len != null) {
if (strictContentLength(msg) && (fromEnd ? msg[kBytesWritten] + len !== msg._contentLength : msg[kBytesWritten] + len > msg._contentLength)
if (
strictContentLength(msg) &&
(fromEnd ? msg[kBytesWritten] + len !== msg._contentLength : msg[kBytesWritten] + len > msg._contentLength)
) {
throw new ERR_HTTP_CONTENT_LENGTH_MISMATCH(len + msg[kBytesWritten], msg._contentLength);
}
Expand Down

0 comments on commit e259ee6

Please sign in to comment.