2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-30 15:24:11 +03:00

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

This commit is contained in:
Gadzhi Gadzhiev
2019-05-07 22:20:34 +03:00
committed by Emily Morehouse
parent 047501f708
commit 0d4fca085b
+1
View File
@@ -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));
}