res.type()
レスポンスヘッダーの "Content-Type" を指定された type
に設定します。
このメソッドはかなり寛容ですが(以下の例を参照)、type
に "/"
が含まれている場合、res.type()
はそれを MIME タイプとみなし、文字通りに解釈することに注意してください。
res.type(type);
res.type('.html');
res.type('html');
res.type('json');
res.type('application/json');
res.type('png');