1001Ferramentas
🤝Dev

HTTP Accept Header Content Negotiation Matcher

Paste a client Accept header and the comma-separated media types a server offers to see which one wins and at what q value. Exact types and */* only.

Match

Which format the server will pick

Content negotiation is the mechanism through which client and server settle on the response format. The client sends what it accepts in Accept, with preferences; the server holds a list of what it can produce; and something has to cross the two. When the outcome is not what you expected, the response arrives in the wrong format or as a 406, and the cause is rarely obvious in the log.

Enter the incoming Accept header and the list of formats your application offers, and the page shows which would win and with what quality factor. The criterion is the highest q among the types present on both sides, with the general wildcard coming into play when the client declares it accepts anything. When nothing matches, the result says so explicitly, which is the 406 scenario.

Worth knowing the limit of this comparison: it handles exact types and the full wildcard, but not the subtype wildcard, of the type-followed-by-asterisk kind. The specification requires giving precedence to the more specific — an exact type beats a subtype wildcard, which beats the general wildcard — and real servers implement that ladder. To check how yours behaves, test with curl sending different headers.

Frequently asked questions

Should I answer 406 when nothing matches?
The specification allows it, but common practice is serving the application default anyway, because a 406 tends to confuse more than it helps — many clients send a malformed Accept without meaning to restrict anything. If you do choose 406, include the list of what you offer in the body.
Does the browser send a restrictive Accept?
When navigating, it sends a long list starting with HTML and XHTML and ending in a wildcard with a low q — that is, it accepts anything, preferring HTML. A JavaScript fetch call, on the other hand, sends a bare wildcard unless you set the header, leaving the choice entirely to the server.
How do I force a specific format?
By sending Accept with only that type. Many APIs also accept an extension in the URL or a query parameter as an alternative, which is easier to test in a browser — but the standard mechanism, the one working without prior agreement, is the header.

Related Tools