1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add guard against the http-request buffer fix being reverted

This commit is contained in:
Nick O'Leary 2017-05-24 11:18:52 +01:00
parent f54f863611
commit 0a6ff900da
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -173,6 +173,12 @@ module.exports = function(RED) {
// msg.url = url; // revert when warning above finally removed
res.on('data',function(chunk) {
if (!Buffer.isBuffer(chunk)) {
// if the 'setEncoding(null)' fix above stops working in
// a new Node.js release, throw a noisy error so we know
// about it.
throw new Error("HTTP Request data chunk not a Buffer");
}
msg.payload.push(chunk);
});
res.on('end',function() {
@ -234,4 +240,3 @@ module.exports = function(RED) {
}
});
}