Is it necessary to set a Content-Type in Node.js?

后端 未结 4 626
难免孤独
难免孤独 2021-01-21 08:33

Just started playing with Node.js and after seeing a few examples I see that usually the Content-Type is set before returning some content.

Usually somethin

4条回答
  •  粉色の甜心
    2021-01-21 09:26

    The Content-Type header is technically optional, but then you are leaving it up to the browser to essentially guess what type of content you are returning. Generally you should always specify a Content-Type if you know the type (which you probably do).

提交回复
热议问题