Skip to content

Commit

Permalink
Set correct JS mime type
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Dec 30, 2024
1 parent 919b971 commit 707420a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ http.createServer(function (request, response) {
options.end = parseInt(matches[2])+1;
response.setHeader('Content-Length', options.end - options.start);
}
// set MIME types
if (fsPath.endsWith(".svg")) {
response.setHeader('Content-Type', "image/svg+xml");
} else if (fsPath.endsWith(".js")) {
response.setHeader('Content-Type', "text/javascript");
}

let fileStream = fs.createReadStream(fsPath, options)
Expand Down

0 comments on commit 707420a

Please sign in to comment.