nodejs & express-4, res.json zurückgibt "Content-Type: text/plain"

Ich versuche meine Anwendung return "application/json" als content-Typ, wenn die Antwort ist ein json-natürlich.

Habe ich versucht:

res.json(jsonContent);

response header has "Content-Type → text/plain; charset=utf-8"

und

res.setHeader('content-type', 'text/json');
res.send(jsonContent); 

response header has "Content-Type → text/plain; charset=utf-8"

und

res.set('content-type', 'text/json');
res.send(jsonContent); 

response header has "Content-Type → text/plain; charset=utf-8"

und alle der oben genannten gleichzeitig. Aber meine app immer Antworten vom server als text/plain und niemals application/json. Was könnte ich falsch gemacht?

InformationsquelleAutor just_user | 2015-10-24
Schreibe einen Kommentar