| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -195,7 +195,7 @@ export default [ | |||
| 195 | 195 | `test/parallel/test-{${ | |
| 196 | 196 | // 0x61 is code for 'a', this generates a string enumerating latin letters: 'a*,b*,…' | |
| 197 | 197 | Array.from({ length: 4 }, (_, i) => String.fromCharCode(0x61 + i, 42)).join(',') | |
| 198 | - },${ | ||
| 198 | + },http-*,${ | ||
| 199 | 199 | // 0x61 is code for 'a', this generates a string enumerating latin letters: 'z*,y*,…' | |
| 200 | 200 | Array.from({ length: 5 }, (_, i) => String.fromCharCode(0x61 + 25 - i, 42)).join(',') | |
| 201 | 201 | }}.{js,mjs,cjs}`, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ function test(handler, request_generator, response_validator) { | |||
| 34 | 34 | let server_response = ''; | |
| 35 | 35 | ||
| 36 | 36 | server.listen(0); | |
| 37 | - server.on('listening', function() { | ||
| 37 | + server.on('listening', common.mustCall(function() { | ||
| 38 | 38 | const c = net.createConnection(this.address().port); | |
| 39 | 39 | ||
| 40 | 40 | c.setEncoding('utf8'); | |
@@ -53,7 +53,7 @@ function test(handler, request_generator, response_validator) { | |||
| 53 | 53 | server.close(); | |
| 54 | 54 | response_validator(server_response, client_got_eof, false); | |
| 55 | 55 | })); | |
| 56 | - }); | ||
| 56 | + })); | ||
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | 59 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,7 +52,7 @@ server.listen(0, common.mustCall(() => { | |||
| 52 | 52 | }; | |
| 53 | 53 | ||
| 54 | 54 | const req1 = http.request(options); | |
| 55 | - req1.on('response', (res1) => { | ||
| 55 | + req1.on('response', common.mustCall((res1) => { | ||
| 56 | 56 | assert.strictEqual(Object.keys(agent.sockets).length, 1); | |
| 57 | 57 | assert.strictEqual(Object.keys(agent.requests).length, 0); | |
| 58 | 58 | ||
@@ -68,10 +68,10 @@ server.listen(0, common.mustCall(() => { | |||
| 68 | 68 | ||
| 69 | 69 | // TODO(jasnell): This event does not appear to currently be triggered. | |
| 70 | 70 | // is this handler actually required? | |
| 71 | - req2.on('error', (err) => { | ||
| 71 | + req2.on('error', common.mustCallAtLeast((err) => { | ||
| 72 | 72 | // This is expected in response to our explicit abort call | |
| 73 | 73 | assert.strictEqual(err.code, 'ECONNRESET'); | |
| 74 | - }); | ||
| 74 | + }, 0)); | ||
| 75 | 75 | ||
| 76 | 76 | req2.end(); | |
| 77 | 77 | req2.abort(); | |
@@ -89,7 +89,7 @@ server.listen(0, common.mustCall(() => { | |||
| 89 | 89 | server.close(); | |
| 90 | 90 | }), 100); | |
| 91 | 91 | })); | |
| 92 | - }); | ||
| 92 | + })); | ||
| 93 | 93 | ||
| 94 | 94 | req1.end(); | |
| 95 | 95 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,21 +38,21 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 38 | 38 | res.end(); | |
| 39 | 39 | })); | |
| 40 | 40 | ||
| 41 | - server.listen(0, () => { | ||
| 41 | + server.listen(0, common.mustCall(() => { | ||
| 42 | 42 | const res = common.mustCall((res) => { | |
| 43 | - res.on('data', (chunk) => { | ||
| 43 | + res.on('data', common.mustCallAtLeast((chunk) => { | ||
| 44 | 44 | size += chunk.length; | |
| 45 | 45 | assert(!req.aborted, 'got data after abort'); | |
| 46 | 46 | if (size > maxSize) { | |
| 47 | 47 | req.abort(); | |
| 48 | 48 | assert.strictEqual(req.aborted, true); | |
| 49 | 49 | size = maxSize; | |
| 50 | 50 | } | |
| 51 | - }); | ||
| 51 | + })); | ||
| 52 | 52 | ||
| 53 | 53 | req.on('abort', common.mustCall(() => assert.strictEqual(size, maxSize))); | |
| 54 | 54 | assert.strictEqual(req.aborted, false); | |
| 55 | 55 | }); | |
| 56 | 56 | ||
| 57 | 57 | const req = http.get(`http://localhost:${server.address().port}`, res); | |
| 58 | - }); | ||
| 58 | + })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 9 | 9 | res.end('hello world'); | |
| 10 | 10 | }, 2)); | |
| 11 | 11 | ||
| 12 | - server.listen(0, () => { | ||
| 12 | + server.listen(0, common.mustCall(() => { | ||
| 13 | 13 | const agent = new Agent({ keepAlive: true }); | |
| 14 | 14 | ||
| 15 | 15 | const requestParams = { | |
@@ -46,4 +46,4 @@ server.listen(0, () => { | |||
| 46 | 46 | agent.destroy(); | |
| 47 | 47 | server.close(); | |
| 48 | 48 | } | |
| 49 | - }); | ||
| 49 | + })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,11 +16,11 @@ const server = http.createServer(common.mustCall((req, res) => { | |||
| 16 | 16 | ||
| 17 | 17 | server.listen(0, common.mustCall(() => { | |
| 18 | 18 | const createConnection = agent.createConnection; | |
| 19 | - agent.createConnection = (options, ...args) => { | ||
| 19 | + agent.createConnection = common.mustCall((options, ...args) => { | ||
| 20 | 20 | assert.strictEqual(options.keepAlive, true); | |
| 21 | 21 | assert.strictEqual(options.keepAliveInitialDelay, agent.keepAliveMsecs); | |
| 22 | 22 | return createConnection.call(agent, options, ...args); | |
| 23 | - }; | ||
| 23 | + }); | ||
| 24 | 24 | http.get({ | |
| 25 | 25 | host: 'localhost', | |
| 26 | 26 | port: server.address().port, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,13 +26,13 @@ function get(path, callback) { | |||
| 26 | 26 | }, callback); | |
| 27 | 27 | } | |
| 28 | 28 | ||
| 29 | - const countdown = new Countdown(2, () => { | ||
| 29 | + const countdown = new Countdown(2, common.mustCall(() => { | ||
| 30 | 30 | const freepool = agent.freeSockets[Object.keys(agent.freeSockets)[0]]; | |
| 31 | 31 | assert.strictEqual(freepool.length, 2, | |
| 32 | 32 | `expect keep 2 free sockets, but got ${freepool.length}`); | |
| 33 | 33 | agent.destroy(); | |
| 34 | 34 | server.close(); | |
| 35 | - }); | ||
| 35 | + })); | ||
| 36 | 36 | ||
| 37 | 37 | function dec() { | |
| 38 | 38 | process.nextTick(() => countdown.dec()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,12 +48,12 @@ function start(param = {}) { | |||
| 48 | 48 | server.keepAliveTimeout = 0; | |
| 49 | 49 | server2.keepAliveTimeout = 0; | |
| 50 | 50 | ||
| 51 | - const countdown = new Countdown(12, () => { | ||
| 51 | + const countdown = new Countdown(12, common.mustCall(() => { | ||
| 52 | 52 | assert.strictEqual(getRequestCount(), 0); | |
| 53 | 53 | agent.destroy(); | |
| 54 | 54 | server.close(); | |
| 55 | 55 | server2.close(); | |
| 56 | - }); | ||
| 56 | + })); | ||
| 57 | 57 | ||
| 58 | 58 | function handler(s) { | |
| 59 | 59 | for (let i = 0; i < 6; i++) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | const { mustCall } = require('../common'); | |
| 3 | 3 | ||
| 4 | 4 | const http = require('http'); | |
| 5 | - const { strictEqual } = require('assert'); | ||
| 5 | + const assert = require('assert'); | ||
| 6 | 6 | ||
| 7 | 7 | const server = http.createServer(mustCall((req, res) => { | |
| 8 | 8 | res.flushHeaders(); | |
@@ -14,7 +14,7 @@ server.listen(0, mustCall(() => { | |||
| 14 | 14 | }, mustCall(() => { | |
| 15 | 15 | const { socket } = req; | |
| 16 | 16 | socket.emit('agentRemove'); | |
| 17 | - strictEqual(socket._httpMessage, req); | ||
| 17 | + assert.strictEqual(socket._httpMessage, req); | ||
| 18 | 18 | socket.destroy(); | |
| 19 | 19 | server.close(); | |
| 20 | 20 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,14 +28,14 @@ function sendFstReq(serverPort) { | |||
| 28 | 28 | agent, | |
| 29 | 29 | host: '127.0.0.1', | |
| 30 | 30 | port: serverPort, | |
| 31 | - }, (res) => { | ||
| 31 | + }, common.mustCall((res) => { | ||
| 32 | 32 | res.on('data', noop); | |
| 33 | 33 | res.on('end', common.mustCall(() => { | |
| 34 | 34 | // Agent's socket reusing code is registered to process.nextTick(), | |
| 35 | 35 | // and will be run after this function, make sure it take effect. | |
| 36 | 36 | setImmediate(sendSecReq, serverPort, req.socket.localPort); | |
| 37 | 37 | })); | |
| 38 | - }); | ||
| 38 | + })); | ||
| 39 | 39 | ||
| 40 | 40 | // Make the `req.socket` non drained, i.e. has some data queued to write to | |
| 41 | 41 | // and accept by the kernel. In Linux and Mac, we only need to call `req.end(aLargeBuffer)`. | |
@@ -60,8 +60,8 @@ function sendFstReq(serverPort) { | |||
| 60 | 60 | * back the socket within SO_SNDBUF quota or only one outstanding send condition. | |
| 61 | 61 | */ | |
| 62 | 62 | ||
| 63 | - req.on('socket', () => { | ||
| 64 | - req.socket.on('connect', () => { | ||
| 63 | + req.on('socket', common.mustCall(() => { | ||
| 64 | + req.socket.on('connect', common.mustCall(() => { | ||
| 65 | 65 | // Print tcp send buffer information | |
| 66 | 66 | console.log(process.report.getReport().libuv.filter((handle) => handle.type === 'tcp')); | |
| 67 | 67 | ||
@@ -81,8 +81,8 @@ function sendFstReq(serverPort) { | |||
| 81 | 81 | ||
| 82 | 82 | req.end(dataLargerThanTCPSendBuf); | |
| 83 | 83 | assert.ok(req.socket.writableLength > 0); | |
| 84 | - }); | ||
| 85 | - }); | ||
| 84 | + })); | ||
| 85 | + })); | ||
| 86 | 86 | } | |
| 87 | 87 | ||
| 88 | 88 | function sendSecReq(serverPort, fstReqCliPort) { | |
@@ -92,12 +92,12 @@ function sendSecReq(serverPort, fstReqCliPort) { | |||
| 92 | 92 | agent, | |
| 93 | 93 | host: '127.0.0.1', | |
| 94 | 94 | port: serverPort, | |
| 95 | - }, (res) => { | ||
| 95 | + }, common.mustCall((res) => { | ||
| 96 | 96 | res.on('data', noop); | |
| 97 | 97 | res.on('end', common.mustCall(() => { | |
| 98 | 98 | setImmediate(sendThrReq, serverPort, req.socket.localPort); | |
| 99 | 99 | })); | |
| 100 | - }); | ||
| 100 | + })); | ||
| 101 | 101 | ||
| 102 | 102 | req.on('socket', common.mustCall((sock) => { | |
| 103 | 103 | assert.notStrictEqual(sock.localPort, fstReqCliPort); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments