Send proper Content-Type of js and css.

This commit is contained in:
Jos van den Oever
2011-02-23 18:23:11 +01:00
parent 74a2b665d8
commit 036f12b102
+7 -1
View File
@@ -57,7 +57,13 @@ http.createServer(function (request, response) {
response.end();
return;
}
response.writeHead(200, {"Content-Length": stats.size});
var head = {"Content-Length": stats.size};
if (filename.substr(-3) === ".js") {
head["Content-Type"] = "text/javascript";
} else if (filename.substr(-4) === ".css") {
head["Content-Type"] = "text/css";
}
response.writeHead(200, head);
if (request.method !== "HEAD") {
response.write(file, "binary");
}