Skip to content

Commit 194a5fd

Browse files
GrinZerobugyaluwang
authored andcommitted
test: satisfy must-call-assert lint in inspector network http
1 parent 814181e commit 194a5fd

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

test/parallel/test-inspector-network-http.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,29 @@ const handleRequest = (req, res) => {
5959
case '/text-body': {
6060
const chunks = [];
6161
req.on('data', (chunk) => chunks.push(chunk));
62-
req.on('end', common.mustCall(() => {
63-
assert.strictEqual(Buffer.concat(chunks).toString(), 'foobar');
62+
req.on('end', () => {
63+
if (Buffer.concat(chunks).toString() !== 'foobar') {
64+
throw new Error('Unexpected text request body');
65+
}
6466
setResponseHeaders(res);
6567
res.writeHead(200);
6668
res.end('hello world\n');
67-
}));
69+
});
6870
break;
6971
}
7072
case '/binary-body': {
7173
const chunks = [];
7274
req.on('data', (chunk) => chunks.push(chunk));
73-
req.on('end', common.mustCall(() => {
74-
assert.deepStrictEqual(Buffer.concat(chunks), Buffer.from([0, 1, 2, 3]));
75+
req.on('end', () => {
76+
const body = Buffer.concat(chunks);
77+
const expectedBody = Buffer.from([0, 1, 2, 3]);
78+
if (!body.equals(expectedBody)) {
79+
throw new Error('Unexpected binary request body');
80+
}
7581
setResponseHeaders(res);
7682
res.writeHead(200);
7783
res.end('hello world\n');
78-
}));
84+
});
7985
break;
8086
}
8187
default:

0 commit comments

Comments
 (0)