* @see https://fetch.spec.whatwg.org/#concept-header-value-normalize * @param {string} potentialValue * @returns {string}
(potentialValue)
| 27 | * @returns {string} |
| 28 | */ |
| 29 | function headerValueNormalize (potentialValue) { |
| 30 | // To normalize a byte sequence potentialValue, remove |
| 31 | // any leading and trailing HTTP whitespace bytes from |
| 32 | // potentialValue. |
| 33 | let i = 0; let j = potentialValue.length |
| 34 | |
| 35 | while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(j - 1))) --j |
| 36 | while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i))) ++i |
| 37 | |
| 38 | return i === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i, j) |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @param {Headers} headers |
no test coverage detected