HTTP Accept Header Value

When the Accept Accept header of the browser says something like the following:

Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 

Does this mean that application/xml , application/xhtml+xml and text/html have a quality parameter of 0.9 ?

Or does this mean that application/xml and application/xhtml+xml have a default value ( q=1 ) and text/html have a parameter of q=0.9 ?

I suppose the first, but hoped that someone knows more definitively.

+43
mime-types content-negotiation
Mar 16 '11 at 20:40
source share
2 answers

No, if there is no quality parameter q=1.0 it is assumed:

One or more accept-params parameters MAY follow in each media range, starting with the "q" parameter to indicate the relative quality factor [...] using the qvalue scale from 0 to 1 (section 3.9). The default value is q = 1.

Thus, this value should be interpreted as "application / xml, application / xhtml + xml and image / png are the preferred types of media, but if they do not exist, send a text / html object ( text/html;q=0.9 ), and if it does not exist, send the text / plain object ( text/plain;q=0.8 ), and if it does not exist, send the object with any other type of media ( */*;q=0.5 ). "

+43
Mar 16 2018-11-11T00:
source

Verbally, this will be interpreted as "application / xml, application / xhtml + xml and image / png are the preferred types of media, but if they do not exist, send a text / html object, and if it does not exist, send a text / regular entity if this doesn’t exist yet, send the entity with any other type of medium. "

0
Aug 18 '15 at 1:15
source



All Articles