Answer the question
In order to leave comments, you need to log in
Is it obligatory to indicate the content type in the responses to the client?
Tell me, is it necessary to write in the answer to the client? res.setHeader("Content-Type", "text/css")
And why is it always indicated in books on node?
Answer the question
In order to leave comments, you need to log in
The Content-Type header is optional, but the Content-Type is better if known.
This header is needed so that the browser understands what type of content the server returns.
Here is what they write about this in the documentation ( https://nodejs.org/api/http.html#http_response_wri... ), if this header is not specified "it will switch to implicit header mode and flush the implicit headers", i.e. .e. the node will specify it implicitly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question