0

Could someone help me clarify what the number values of the q parameter represent. I know that the values are used to select your preference but what I do not understand is how the numbers are used. For example in the below code would my preference remain the same if I were to use application/json;q=0.3,*/*,q=0.2?

headers.append('Accept', 'application/json;q=0.9,*/*;q=0.8');
SilverlightFox
  • 32,436
  • 11
  • 76
  • 145
TyAnthoney
  • 278
  • 4
  • 12

1 Answers1

1

It depends on the server application.

Your first statement is saying "I will accept json if you can guarantee 30% quality, but if not I can accept anything at 20% quality".

Your second is saying "I will accept json if you can guarantee 90% quality, but if not I can accept anything at 80% quality".

However, the application could take that to mean "provide json if you can, otherwise anything else".

Official spec here.

For more details see this question.

Community
  • 1
  • 1
SilverlightFox
  • 32,436
  • 11
  • 76
  • 145