Skip to content
Permalink
Browse files

Destroy stream on exceeding maxContentLength (fixes #1098) (#1485)

  • Loading branch information
Gadzhi Gadzhiev authored and emilyemorehouse committed May 7, 2019
1 parent 047501f commit 0d4fca085b9b44e110f4c5a3dd7384c31abaf756
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/adapters/http.js
@@ -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));
}

0 comments on commit 0d4fca0

Please sign in to comment.
You can’t perform that action at this time.