Content negotiation is a way to serve client-specific representations of the same resource.
A client might send this HTTP request:
In response, the server might send:
HTTP/1.1 200 OK <strong>Content-Type:</strong> application/json; charset=utf-8 Content-Length: 57 Connection: Close
The Accept header is used by HTTP clients to tell the server what content types they’ll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is.
However, as you may have noticed, HTTP requests can also contain Content-Type headers. Why? Well, think about POST or PUT requests. With those request types, the client is actually sending a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).
In particular, for a typical POST request resulting from an HTML form submission, the Content-Type of the request will normally be either application/x-www-form-urlencoded or multipart/form-data.