Emitted when the request has been aborted by the client. This event is only
emitted on the first call to `abort()`.
-### request.flush()
+### request.flushHeaders()
Flush the request headers.
hard to pack the request headers and data into a single TCP packet.
That's usually what you want (it saves a TCP round-trip) but not when the first
-data isn't sent until possibly much later. `request.flush()` lets you bypass
+data isn't sent until possibly much later. `request.flushHeaders()` lets you bypass
the optimization and kickstart the request.
### request.write(chunk[, encoding][, callback])
};
-OutgoingMessage.prototype.flush = function() {
+OutgoingMessage.prototype.flushHeaders = function() {
if (!this._header) {
// Force-flush the headers.
this._implicitHeader();
this._send('');
}
};
+
+OutgoingMessage.prototype.flush = util.deprecate(function() {
+ this.flushHeaders();
+}, 'flush is deprecated. Use flushHeaders instead.');
--- /dev/null
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const http = require('http');
+
+const server = http.createServer();
+server.on('request', function(req, res){
+ assert(req.headers['foo'], 'bar');
+ res.end('ok');
+ server.close();
+});
+server.listen(common.PORT, '127.0.0.1', function() {
+ let req = http.request({
+ method: 'GET',
+ host: '127.0.0.1',
+ port: common.PORT,
+ });
+ req.setHeader('foo', 'bar');
+ req.flushHeaders();
+});