Kit Sunde Kit Sunde - 1 month ago 7
Javascript Question

Why isn't express-js setting the Content-Type header?

I have the following:

var express = require('express'),
app = express.createServer();

app.get("/offline.manifest", function(req, res){
res.contentType("text/cache-manifest");
res.end("CACHE MANIFEST");
});

app.listen(8561);


The network tab in Chrome says it's
text/plain
. Why isn't it setting the header?

The code above works, my problems were caused by a linking to an old version of express-js

Answer

res.type('json') works too now