Web Development
web
http
api
What is Content-Type Header?
Definition
The Content-Type HTTP header indicates the MIME type of the request or response body. It tells the receiver how to parse the data — for example, application/json for JSON, text/html for web pages, and multipart/form-data for file uploads.
Why It Matters
Incorrect Content-Type headers cause parsing failures, CORS errors, and security vulnerabilities. When an API returns JSON with text/html Content-Type, the client may fail to parse it. Setting correct Content-Type is essential for API development.