Expressでcharset無しのContent-TypeでJSONを返すにはこうする必要があるって本当?
~~~
return res.status(200).setHeader('Content-Type', 'application/json').send(Buffer.from(JSON.stringify({ foo: "bar" }), 'utf-8'));
~~~
以下は全部だめ。
- `.json`でオブジェクトを渡す。
- `.send`でオブジェクトを渡す。
- `.send`で文字列を渡す。
- `.type`で`json`を指定する。
- `.type`で`application/json`を指定する。
- `.set`で`Content-Type`に`application/json`を指定する。