mirror of
https://github.com/wg-easy/wg-easy.git
synced 2025-10-05 15:47:18 +08:00
fix: add Content-Type header for static files
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user