mirror of
https://github.com/zebrajr/node.git
synced 2025-12-07 00:20:38 +01:00
1. Among the list of Code and Learn, I solved the unfinished task of replacing function with arrow function: https://github.com/nodejs/code-and-learn/issues/72#issuecomment-345667395 2. Replace arrow function with shorter property syntax Arrow function makes `this` lexical scope. But toString expects evaluate `this` in runtime. 3. Replace this with null makeBlock does not need `this`. update `this` with `null` to clarify the intent. PR-URL: https://github.com/nodejs/node/pull/17345 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
25 lines
609 B
JavaScript
25 lines
609 B
JavaScript
'use strict';
|
|
// Serving up a zero-length buffer should work.
|
|
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
const server = http.createServer((req, res) => {
|
|
const buffer = Buffer.alloc(0);
|
|
// FIXME: WTF gjslint want this?
|
|
res.writeHead(200, { 'Content-Type': 'text/html',
|
|
'Content-Length': buffer.length });
|
|
res.end(buffer);
|
|
});
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
http.get({ port: server.address().port }, common.mustCall((res) => {
|
|
|
|
res.on('data', common.mustNotCall());
|
|
|
|
res.on('end', (d) => {
|
|
server.close();
|
|
});
|
|
}));
|
|
}));
|