Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
stramel committed Jun 3, 2020
1 parent 6600cf3 commit 40c50b6
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ const sendFile = (
function onError(err) {
if (err) {
res.end()
console.error('An error occurred:', err)
console.error(
chalk.red(
` ✘ An error occurred while compressing ${chalk.bold(req.url)}`,
),
err
);
}
}

Expand All @@ -134,14 +139,6 @@ const sendFile = (
headers['Content-Encoding'] = 'gzip'
res.writeHead(200, headers)
stream.pipeline(raw, zlib.createGzip(), res, onError)
} else if (/\bbr\b/.test(acceptEncoding)) {
headers['Content-Encoding'] = 'br'
res.writeHead(200, headers)
stream.pipeline(raw, zlib.createBrotliCompress(), res, onError);
} else if (/\bdeflate\b/.test(acceptEncoding)) {
headers['Content-Encoding'] = 'deflate'
res.writeHead(200, headers);
stream.pipeline(raw, zlib.createDeflate(), res, onError);
} else {
res.writeHead(200, headers);
res.write(body, getEncodingType(ext));
Expand Down

0 comments on commit 40c50b6

Please sign in to comment.