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:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require('unit-http').createServer(function (req, res) {
|
||||
res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'});
|
||||
res.end('Hello World\n');
|
||||
res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'})
|
||||
.end('Hello World\n');
|
||||
}).listen(7080);
|
||||
|
||||
Reference in New Issue
Block a user