REST API Content-Type Validation

Understand why Content-Type is a very important header in the HTTP request and response structure, the possible security vulnerabilities around it, and how we mitigate those vulnerabilities.

Definition of HTTP requests and responses

Before we get to content type, let’s dissect HTTP requests and responses.

When you enter https://www.example.com/test.html in the browser, the browser creates an HTTP request:

GET /test.html HTTP/1.1

Host: www.example.com

This includes certain headers, such as User-Agent, Accept, and so on.

Get hands-on with 1200+ tech skills courses.