TECHNOLOGY

HTTP Accept: specific exclusions can override a broad wildcard

In this article
THE QUICK TAKE

A broad wildcard does not erase a more specific media-type rule, and a preference header does not prove which representation arrived.

Accept describes the desired response

Accept expresses which media types a caller is prepared to receive. It is different from Content-Type, which describes the representation actually sent in a message. Setting one header does not automatically set the other direction of the contract.

For an agent requesting a document or API resource, this distinction prevents a common error: describing its submitted JSON does not by itself request a JSON response. The client needs a response preference and still needs to inspect the representation it eventually receives.

Quality and specificity have different roles

The HTTP semantics specification gives more specific media ranges precedence when determining the applicable preference for a representation. A consumer should not implement negotiation by taking whichever matching wildcard has the largest weight.

This matters when a broad wildcard is combined with an explicit exclusion of a particular media type. The specific rule remains relevant. A proposed negotiation parser preserves the relationship between a range and its quality rather than flattening all matching entries into an unordered list of acceptable names.

Exclusion is different from low preference

A zero quality value expresses that a representation is not acceptable under the supplied preference. It should not be treated as simply the least attractive option that becomes acceptable whenever every other choice is unavailable.

For an endpoint with several representations, define the response-selection and fallback behavior. A gateway that discards quality parameters can change the consumer’s contract while keeping the visible media-type names. Testing only a simple single-type header will not expose that loss.

Negotiation does not guarantee the received format

The content-negotiation guide describes server-driven selection and fallback responses. The server’s available representations and behavior still matter. A client must inspect the actual response status and media type rather than assuming that sending a preference makes every returned body conform to it.

A proposed consumer distinguishes a supported selected representation, a negotiation failure and an unexpected intermediary response. It should not feed an HTML body into an application JSON decoder merely because its request preferred JSON. The received representation remains the relevant input to parsing.

Review competing ranges and fallback explicitly

A useful review includes a precise type, subtype wildcard, broad wildcard, explicit exclusion and no suitable representation. It also considers multiple requests to the same URL with different preferences when caching is involved.

The purpose is to make media-type preference inspectable without confusing it with application authorization or payload validation. A well-defined contract preserves specificity, quality and actual response interpretation, so a convenience client or gateway does not silently convert a stated exclusion into permission to return an incompatible format.

Primary references

HTTP Accept semantics.

Accept header reference.

Content negotiation guide.

Related explanations: HTTP request boundaries; Operation context.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles