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 30, 2019
1 parent d59c70f commit acabfbd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/adapters/http.js
Expand Up @@ -181,6 +181,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 acabfbd

Please sign in to comment.