Reputation: 3041
I am readying HTTP spec document for the Accept
header and encountered with the following example.
Accept: text/*, text/html, text/html;level=1, */*
# Precedence
1) text/html;level=1
2) text/html
3) text/*
4) */*
I am wondering what algorithm is used to sort the preference of each content-type? Is there any standard documentation for it? Any reference to some implementation or documentation will be appreciated.
Is it correct to say that under the same quality factor, more specific content-types have higher precedence (application/json
> application/*
)?
How come text/html;level=1
has higher preference text/html
?
Upvotes: 1
Views: 37
Reputation: 42045
You're looking at an obsolete spec. See https://greenbytes.de/tech/webdav/rfc7231.html#header.accept for the current one.
In particular:
"Media ranges can be overridden by more specific media ranges or specific media types. If more than one media range applies to a given type, the most specific reference has precedence..." -- https://greenbytes.de/tech/webdav/rfc7231.html#rfc.section.5.3.2.p.10
Upvotes: 1