Content-Type & Accept Headers: How Browsers and APIs Negotiate Response Formats
The same API endpoint can return JSON, XML, or HTML depending on one request header. Here is how Accept and Content-Type headers negotiate response format, and what a 406 actually means.