|
1 | 1 | {
|
2 |
| -"parse_media_range": [ |
3 |
| - ["application/xml;q=1", ["application", "xml", {"q": "1"}]], |
4 |
| - ["application/xml", ["application", "xml", {"q": "1"}]], |
5 |
| - ["application/xml;q=",["application", "xml", {"q": "1"}]], |
6 |
| - ["application/xml ;q=",["application", "xml", {"q": "1"}]], |
7 |
| - ["application/xml ;q=-1",["application", "xml", {"q": "1"}]], |
8 |
| - ["application/xml ; q=1;b=other",["application", "xml", {"q": "1", "b":"other"}]], |
9 |
| - ["application/xml ; q=2;b=other",["application", "xml", {"q": "1", "b":"other"}]], |
10 |
| - ["application/xml ; q=0",["application", "xml", {"q": "0"}]], |
11 |
| - ["application/xml ; q=foo", ["application", "xml", {"q": "1"}]], |
12 |
| - ["application/xml ; Q=0.6", ["application", "xml", {"q": "0.6"}]], |
13 |
| - [" *; q=.2",["*", "*", {"q": ".2"}]] |
14 |
| -], |
| 2 | + "parse_media_range": [ |
| 3 | + ["application/xml;q=1", ["application", "xml", {"q": "1"}]], |
| 4 | + ["application/xml", ["application", "xml", {"q": "1"}]], |
| 5 | + ["application/xml;q=",["application", "xml", {"q": "1"}]], |
| 6 | + ["application/xml ;q=",["application", "xml", {"q": "1"}]], |
| 7 | + ["application/xml ;q=-1",["application", "xml", {"q": "1"}]], |
| 8 | + ["application/xml ; q=1;b=other",["application", "xml", {"q": "1", "b":"other"}]], |
| 9 | + ["application/xml ; q=2;b=other",["application", "xml", {"q": "1", "b":"other"}]], |
| 10 | + ["application/xml ; q=0",["application", "xml", {"q": "0"}]], |
| 11 | + ["application/xml ; q=foo", ["application", "xml", {"q": "1"}]], |
| 12 | + ["application/xml ; Q=0.6", ["application", "xml", {"q": "0.6"}]], |
| 13 | + [" *; q=.2", ["*", "*", {"q": ".2"}]] |
| 14 | + ], |
15 | 15 |
|
16 |
| -"quality": [ |
17 |
| - [["text/html;level=1", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], 1], |
18 |
| - [["text/html", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], 0.7], |
19 |
| - [["text/plain", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], 0.3], |
20 |
| - [["image/jpeg", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], 0.5], |
21 |
| - [["text/html;level=2", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], 0.4], |
22 |
| - [["text/html;level=3", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], 0.7], |
23 |
| - [["text/plain", "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"], 0.2] |
24 |
| -], |
| 16 | + "quality": [ |
| 17 | + [ |
| 18 | + ["text/html;level=1", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], |
| 19 | + 1 |
| 20 | + ], |
| 21 | + [ |
| 22 | + ["text/html", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], |
| 23 | + 0.7 |
| 24 | + ], |
| 25 | + [ |
| 26 | + ["text/plain", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], |
| 27 | + 0.3 |
| 28 | + ], |
| 29 | + [ |
| 30 | + ["image/jpeg", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], |
| 31 | + 0.5 |
| 32 | + ], |
| 33 | + [ |
| 34 | + ["text/html;level=2", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], |
| 35 | + 0.4 |
| 36 | + ], |
| 37 | + [ |
| 38 | + ["text/html;level=3", "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], |
| 39 | + 0.7 |
| 40 | + ], |
| 41 | + [ |
| 42 | + ["text/plain", "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"], |
| 43 | + 0.2 |
| 44 | + ] |
| 45 | + ], |
25 | 46 |
|
26 |
| -"best_match": [ |
27 |
| - [[["application/xbel+xml", "application/xml"], "application/xbel+xml"], "application/xbel+xml", "direct match"], |
28 |
| - [[["application/xbel+xml", "application/xml"], "application/xbel+xml; q=1"], "application/xbel+xml", "direct match with a q parameter"], |
29 |
| - [[["application/xbel+xml", "application/xml"], "application/xml; q=1"], "application/xml", "direct match of our second choice with a q parameter"], |
30 |
| - [[["application/xbel+xml", "application/xml"], "application/*; q=1"], "application/xml", "match using a subtype wildcard"], |
31 |
| - [[["application/xbel+xml", "application/xml"], "*/*", "application/xml"], "application/xml", "match using a type wildcard"], |
32 |
| - [[["application/xbel+xml", "text/xml"], "text/*;q=0.5,*/*; q=0.1"], "text/xml", "match using a type versus a lower weighted subtype"], |
33 |
| - [[["application/xbel+xml", "text/xml"], "text/html,application/atom+xml; q=0.9"], "", "fail to match anything"], |
34 |
| - [[["application/json", "text/html"], "application/json, text/javascript, */*"], "application/json", "common AJAX scenario"], |
35 |
| - [[["application/json", "text/html"], "application/json, text/html;q=0.9"], "application/json", "verify fitness ordering"], |
36 |
| - [[["image/*", "application/xml"], "image/png"], "image/*", "match using a type wildcard"], |
37 |
| - [[["image/*", "application/xml"], "image/*"], "image/*", "match using a wildcard for both requested and supported"], |
38 |
| - [[["image/jpeg", "text/plain"], "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5"], "image/jpeg", "media type with highest associated quality factor should win, not necessarily most specific"], |
39 |
| - [[["text/html", "application/rdf+xml"], "text/html, application/rdf+xml"], "application/rdf+xml", "match should use highest order of supported when there is a tie"], |
40 |
| - [[["application/rdf+xml", "text/html"], "text/html, application/rdf+xml"], "text/html", "match should use highest order of supported when there is a tie"], |
41 |
| - [[["application/json", "text/html"], "text"], null, "match should use the default if an invalid Accept header is passed"] |
42 |
| -], |
| 47 | + "best_match": [ |
| 48 | + [ |
| 49 | + [ |
| 50 | + ["application/json", "text/html"], |
| 51 | + "application/json, text/javascript, */*" |
| 52 | + ], |
| 53 | + "application/json", |
| 54 | + "common AJAX scenario" |
| 55 | + ], |
| 56 | + [ |
| 57 | + [ |
| 58 | + ["application/xbel+xml", "application/xml"], |
| 59 | + "application/xbel+xml" |
| 60 | + ], |
| 61 | + "application/xbel+xml", |
| 62 | + "direct match" |
| 63 | + ], |
| 64 | + [ |
| 65 | + [ |
| 66 | + ["application/xbel+xml", "application/xml"], |
| 67 | + "application/xbel+xml; q=1" |
| 68 | + ], |
| 69 | + "application/xbel+xml", |
| 70 | + "direct match with a q parameter" |
| 71 | + ], |
| 72 | + [ |
| 73 | + [ |
| 74 | + ["application/xbel+xml", "application/xml"], |
| 75 | + "application/xml; q=1" |
| 76 | + ], |
| 77 | + "application/xml", |
| 78 | + "direct match of our second choice with a q parameter" |
| 79 | + ], |
| 80 | + [ |
| 81 | + [ |
| 82 | + ["application/xbel+xml", "application/xml"], |
| 83 | + "application/*; q=1" |
| 84 | + ], |
| 85 | + "application/xml", |
| 86 | + "match using a subtype wildcard" |
| 87 | + ], |
| 88 | + [ |
| 89 | + [ |
| 90 | + ["application/xbel+xml", "application/xml"], |
| 91 | + "*/*", "application/xml" |
| 92 | + ], |
| 93 | + "application/xml", |
| 94 | + "match using a type wildcard" |
| 95 | + ], |
| 96 | + [ |
| 97 | + [ |
| 98 | + ["application/xbel+xml", "text/xml"], |
| 99 | + "text/*;q=0.5,*/*; q=0.1" |
| 100 | + ], |
| 101 | + "text/xml", |
| 102 | + "match using a type versus a lower weighted subtype" |
| 103 | + ], |
| 104 | + [ |
| 105 | + [ |
| 106 | + ["application/xbel+xml", "text/xml"], |
| 107 | + "text/html,application/atom+xml; q=0.9" |
| 108 | + ], |
| 109 | + "", |
| 110 | + "fail to match anything" |
| 111 | + ], |
| 112 | + [ |
| 113 | + [ |
| 114 | + ["application/json", "text/html"], |
| 115 | + "application/json, text/html;q=0.9" |
| 116 | + ], |
| 117 | + "application/json", |
| 118 | + "verify fitness ordering" |
| 119 | + ], |
| 120 | + [ |
| 121 | + [ |
| 122 | + ["image/*", "application/xml"], |
| 123 | + "image/png" |
| 124 | + ], |
| 125 | + "image/*", |
| 126 | + "match using a type wildcard" |
| 127 | + ], |
| 128 | + [ |
| 129 | + [ |
| 130 | + ["image/*", "application/xml"], |
| 131 | + "image/*" |
| 132 | + ], |
| 133 | + "image/*", |
| 134 | + "match using a wildcard for both requested and supported" |
| 135 | + ], |
| 136 | + [ |
| 137 | + [ |
| 138 | + ["image/jpeg", "text/plain"], |
| 139 | + "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5" |
| 140 | + ], |
| 141 | + "image/jpeg", |
| 142 | + "media type with highest associated quality factor should win, not necessarily most specific" |
| 143 | + ], |
| 144 | + [ |
| 145 | + [ |
| 146 | + ["text/html", "application/rdf+xml"], |
| 147 | + "text/html, application/rdf+xml" |
| 148 | + ], |
| 149 | + "application/rdf+xml", |
| 150 | + "match should use highest order of supported when there is a tie" |
| 151 | + ], |
| 152 | + [ |
| 153 | + [ |
| 154 | + ["application/rdf+xml", "text/html"], |
| 155 | + "text/html, application/rdf+xml" |
| 156 | + ], |
| 157 | + "text/html", |
| 158 | + "match should use highest order of supported when there is a tie" |
| 159 | + ], |
| 160 | + [ |
| 161 | + [ |
| 162 | + ["application/json", "text/html"], |
| 163 | + "text" |
| 164 | + ], |
| 165 | + null, |
| 166 | + "match should use the default if an invalid Accept header is passed" |
| 167 | + ] |
| 168 | + ], |
43 | 169 |
|
44 |
| -"parse_mime_type": [ |
45 |
| - ["application/xhtml;q=0.5", ["application", "xhtml", {"q": "0.5"}]], |
46 |
| - ["application/xhtml;q=0.5;ver=1.2", ["application", "xhtml", {"q": "0.5", "ver": "1.2"}]], |
47 |
| - ["application/xhtml;q=0.5;foo=\"bar quux\"", ["application", "xhtml", {"q": "0.5", "foo": "bar quux"}]], |
48 |
| - ["text", null], |
49 |
| - ["text/something/invalid", null] |
50 |
| -] |
| 170 | + "parse_mime_type": [ |
| 171 | + [ |
| 172 | + "application/xhtml;q=0.5", |
| 173 | + ["application", "xhtml", {"q": "0.5"}] |
| 174 | + ], |
| 175 | + [ |
| 176 | + "application/xhtml;q=0.5;ver=1.2", |
| 177 | + ["application", "xhtml", {"q": "0.5", "ver": "1.2"}] |
| 178 | + ], |
| 179 | + [ |
| 180 | + "application/xhtml;q=0.5;foo=\"bar quux\"", |
| 181 | + ["application", "xhtml", {"q": "0.5", "foo": "bar quux"}]], |
| 182 | + [ |
| 183 | + "text", null |
| 184 | + ], |
| 185 | + [ |
| 186 | + "text/something/invalid", null |
| 187 | + ] |
| 188 | + ] |
51 | 189 | }
|
0 commit comments