node/test/parallel/test-v8-inspector-json-protocol.js
Ben Noordhuis 782620f03f src: add /json/protocol endpoint to inspector
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>
2016-09-23 18:51:47 +02:00

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);
}));
}));