blob: e4754a465fcf5f637dcb073e3d01afdc651ec5ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import { skipIfInspectorDisabled, mustCall } from '../common/index.mjs';
skipIfInspectorDisabled();
import startCLI from '../common/debugger.js';
import assert from 'assert';
import http from 'http';
const host = '127.0.0.1';
{
const server = http.createServer((req, res) => {
res.statusCode = 400;
res.end('Bad Request');
});
server.listen(0, mustCall(async () => {
const port = server.address().port;
const cli = startCLI([`${host}:${port}`]);
try {
const code = await cli.quit();
assert.strictEqual(code, 1);
} finally {
server.close();
}
}));
}
{
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.end('some data that is invalid json');
});
server.listen(0, host, mustCall(async () => {
const port = server.address().port;
const cli = startCLI([`${host}:${port}`]);
try {
const code = await cli.quit();
assert.strictEqual(code, 1);
} finally {
server.close();
}
}));
}
|