diff --git a/bin/generate-fixtures.js b/bin/generate-fixtures.js index de0f1b7..c45ab00 100644 --- a/bin/generate-fixtures.js +++ b/bin/generate-fixtures.js @@ -11,33 +11,32 @@ const errorCb = (err) => { for (const suite of testSuites) { for (const request of Object.keys(suite.requests)) { - let content = {} const type = mime.contentType(request) - content = Object.assign(content, { + let content = { 'Content-Type': type || null, 'Content-Encoding': compressible(type) ? 'gzip' : null - }) + } if (suite.default && suite.default.responseHeaders) { content = Object.assign(content, suite.default.responseHeaders) } if (suite.requests[request].responseHeaders) { content = Object.assign(content, suite.requests[request].responseHeaders) } - fs.outputFile(`fixtures/${request}`, JSON.stringify(content), errorCb) + fs.outputJsonSync(`fixtures/${request}`, content) } } +fs.outputFile('fixtures/test.svgz', zlib.gzipSync(fs.readFileSync('fixtures/test.svgz')), errorCb) + for (const folder of ['/', '.well-known/', '.well-known/test/']) { - fs.outputFile(`fixtures/${folder}.hidden_directory/test.html`, '', (err) => { - if (err) throw err - }) + fs.outputFile(`fixtures/${folder}.hidden_directory/test.html`, '', errorCb) } -fs.outputFile(`fixtures/test-pre-gzip.js.gz`, zlib.gzipSync(JSON.stringify({ +fs.outputFile('fixtures/test-pre-gzip.js.gz', zlib.gzipSync(JSON.stringify({ 'Content-Type': 'text/javascript; charset=utf-8', 'Content-Encoding': 'gzip' })), errorCb) -fs.outputFile(`fixtures/test-pre-gzip.js.br`, zlib.brotliCompressSync(JSON.stringify({ +fs.outputFile('fixtures/test-pre-gzip.js.br', zlib.brotliCompressSync(JSON.stringify({ 'Content-Type': 'text/javascript; charset=utf-8', 'Content-Encoding': 'br' })), errorCb)