Senior
What does the Content-Type header do?
sobes.tech AI
Answer from AI
The HTTP request or response header Content-Type indicates the media type (MIME type) of the content transmitted in the message body. This allows the recipient to understand how to interpret the data — for example, JSON, XML, HTML, image, etc.
Example: when sending JSON in the request body, the Content-Type will be "application/json". The server, seeing this header, will understand that it needs to parse the body as JSON.
Content-Type: application/json
Thus, Content-Type plays a key role in the correct processing of data between the client and server.