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,8 +6,7 @@ require('unit-http').createServer(function (req, res) {
|
||||
res.end();
|
||||
|
||||
if (req.headers['x-write-call']) {
|
||||
res.writeHead(200, {'Content-Type': 'text/plain'});
|
||||
res.write('blah');
|
||||
res.writeHead(200, {'Content-Type': 'text/plain'}).write('blah');
|
||||
}
|
||||
|
||||
Promise.resolve().then(() => {
|
||||
|
||||
Reference in New Issue
Block a user