Skip to content

Commit

Permalink
fix: add Content-Type header for static files (wg-easy#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
pheiduck committed Mar 23, 2024
2 parents c2829d7 + 8d00c54 commit f134a36
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ module.exports = class Server {
return;
}

if (id.endsWith('.html')) setHeader(event, 'Content-Type', 'text/html');
if (id.endsWith('.js')) setHeader(event, 'Content-Type', 'application/javascript');
if (id.endsWith('.json')) setHeader(event, 'Content-Type', 'application/json');
if (id.endsWith('.css')) setHeader(event, 'Content-Type', 'text/css');
if (id.endsWith('.png')) setHeader(event, 'Content-Type', 'image/png');

return {
size: stats.size,
mtime: stats.mtimeMs,
Expand Down

0 comments on commit f134a36

Please sign in to comment.