Skip to content

Commit

Permalink
Destroy stream on exceeding maxContentLength (fixes #1098) (#1485)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadzhi Gadzhiev authored and emilyemorehouse committed May 7, 2019
1 parent 047501f commit 0d4fca0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/adapters/http.js
Expand Up @@ -216,6 +216,7 @@ module.exports = function httpAdapter(config) {

// make sure the content length is not over the maxContentLength if specified
if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
stream.destroy();
reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
config, null, lastRequest));
}
Expand Down

0 comments on commit 0d4fca0

Please sign in to comment.