Node.js: returning "this" from writeHead() to allow chaining.
In Node.js version 11.10.0 and later, the writeHead() function returns "this".
This commit is contained in:
@@ -6,7 +6,7 @@ require('unit-http').createServer(function (req, res) {
|
||||
body += chunk.toString();
|
||||
});
|
||||
req.on('end', () => {
|
||||
res.writeHead(200, {'Content-Length': Buffer.byteLength(body)});
|
||||
res.end(body);
|
||||
res.writeHead(200, {'Content-Length': Buffer.byteLength(body)})
|
||||
.end(body);
|
||||
});
|
||||
}).listen(7080);
|
||||
|
||||
Reference in New Issue
Block a user