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:
@@ -14,7 +14,6 @@ require('unit-http').createServer(function (req, res) {
|
||||
res.setHeader('Content-Type', req.headers['content-type']);
|
||||
res.setHeader('Custom-Header', req.headers['custom-header']);
|
||||
res.setHeader('Http-Host', req.headers['host']);
|
||||
res.writeHead(200, {});
|
||||
res.end(body);
|
||||
res.writeHead(200, {}).end(body);
|
||||
});
|
||||
}).listen(7080);
|
||||
|
||||
Reference in New Issue
Block a user