Several changes:
* Soft-Deprecate Buffer() constructors
* Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()`
* Add `--zero-fill-buffers` command line option
* Add byteOffset and length to `new Buffer(arrayBuffer)` constructor
* buffer.fill('') previously had no effect, now zero-fills
* Update the docs
PR-URL: https://github.com/nodejs/node/pull/4682
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
29 lines
589 B
JavaScript
29 lines
589 B
JavaScript
// Called by test/pummel/test-regress-GH-892.js
|
|
|
|
var https = require('https');
|
|
var fs = require('fs');
|
|
var assert = require('assert');
|
|
|
|
var PORT = parseInt(process.argv[2]);
|
|
var bytesExpected = parseInt(process.argv[3]);
|
|
|
|
var gotResponse = false;
|
|
|
|
var options = {
|
|
method: 'POST',
|
|
port: PORT,
|
|
rejectUnauthorized: false
|
|
};
|
|
|
|
var req = https.request(options, function(res) {
|
|
assert.equal(200, res.statusCode);
|
|
gotResponse = true;
|
|
console.error('DONE');
|
|
res.resume();
|
|
});
|
|
|
|
req.end(Buffer.allocUnsafe(bytesExpected));
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(gotResponse);
|
|
});
|