mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 23:52:40 +00:00

Embed the compressed and minified protocol.json from the bundled v8_inspector and make it available through the /json/protocol endpoint. Refs: https://github.com/nodejs/diagnostics/issues/52 PR-URL: https://github.com/nodejs/node/pull/7491 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
23 lines
523 B
JavaScript
23 lines
523 B
JavaScript
// Flags: --inspect={PORT}
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const options = {
|
|
path: '/json/protocol',
|
|
port: common.PORT,
|
|
host: common.localhostIPv4,
|
|
};
|
|
|
|
http.get(options, common.mustCall((res) => {
|
|
let body = '';
|
|
res.setEncoding('utf8');
|
|
res.on('data', (data) => body += data);
|
|
res.on('end', common.mustCall(() => {
|
|
assert(body.length > 0);
|
|
assert.deepStrictEqual(JSON.stringify(JSON.parse(body)), body);
|
|
}));
|
|
}));
|