(accept: string)
| 86 | } |
| 87 | |
| 88 | function parseAcceptEncoding(accept: string): EncodingSpecificity[] { |
| 89 | const accepts = accept.split(","); |
| 90 | const parsedAccepts: EncodingSpecificity[] = []; |
| 91 | let hasIdentity = false; |
| 92 | let minQuality = 1; |
| 93 | |
| 94 | for (const [i, accept] of accepts.entries()) { |
| 95 | const encoding = parseEncoding(accept.trim(), i); |
| 96 | |
| 97 | if (encoding) { |
| 98 | parsedAccepts.push(encoding); |
| 99 | hasIdentity = hasIdentity || !!specify("identity", encoding); |
| 100 | minQuality = Math.min(minQuality, encoding.q || 1); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | if (!hasIdentity) { |
| 105 | parsedAccepts.push({ |
| 106 | encoding: "identity", |
| 107 | o: undefined, |
| 108 | q: minQuality, |
| 109 | i: accepts.length - 1, |
| 110 | s: undefined, |
| 111 | }); |
| 112 | } |
| 113 | |
| 114 | return parsedAccepts; |
| 115 | } |
| 116 | |
| 117 | function getEncodingPriority( |
| 118 | encoding: string, |
no test coverage detected