send the test files with the correct content-type header

This commit is contained in:
webzwo0i 2020-12-27 23:32:09 +01:00 committed by John McLear
parent 951c93fa6d
commit ca405c1685

View file

@ -17,7 +17,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
files = files.filter((f) => f.endsWith('.js')); files = files.filter((f) => f.endsWith('.js'));
console.debug('Sent browser the following test specs:', files); console.debug('Sent browser the following test specs:', files);
res.setHeader('content-type', 'text/javascript'); res.setHeader('content-type', 'application/javascript');
res.end(`var specs_list = ${JSON.stringify(files)};\n`); res.end(`var specs_list = ${JSON.stringify(files)};\n`);
}); });
@ -49,6 +49,8 @@ exports.expressCreateServer = function (hook_name, args, cb) {
content = `describe(${JSON.stringify(specFileName)}, function(){ ${content} });`; content = `describe(${JSON.stringify(specFileName)}, function(){ ${content} });`;
if(!specFilePath.endsWith('index.html')) res.setHeader('content-type', 'application/javascript');
res.send(content); res.send(content);
}); });
}); });