Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const npmArchive = createArchive({
'package/bin/npm-cli.js': '// fixture\n',
'package/bin/npx-cli.js': '// fixture\n',
});
const npmIntegrity = `sha512-${createHash('sha512').update(npmArchive).digest('base64')}`;
let downloads = 0;
const server = createServer(function handleRequest(request, response) {
if (request.url.endsWith('/SHASUMS256.txt.asc')) {
Expand All @@ -32,6 +33,11 @@ const server = createServer(function handleRequest(request, response) {
response.end(`${createHash('sha256').update(nodeArchive).digest('hex')} ${nodeRoot}.tar.gz\n`);
return;
}
if (request.url === `/npm/${version}`) {
response.setHeader('Content-Type', 'application/json');
response.end(JSON.stringify({ dist: { integrity: npmIntegrity } }));
return;
}
let body;
if (request.url.endsWith(`/${nodeRoot}.tar.gz`)) {
body = nodeArchive;
Expand Down
Loading
Loading