* @param {string} characters * @returns {boolean}
(characters)
| 745 | * @returns {boolean} |
| 746 | */ |
| 747 | function isValidHTTPToken (characters) { |
| 748 | if (characters.length >= 12) return tokenRegExp.test(characters) |
| 749 | if (characters.length === 0) return false |
| 750 | |
| 751 | for (let i = 0; i < characters.length; i++) { |
| 752 | if (validTokenChars[characters.charCodeAt(i)] !== 1) { |
| 753 | return false |
| 754 | } |
| 755 | } |
| 756 | return true |
| 757 | } |
| 758 | |
| 759 | // headerCharRegex have been lifted from |
| 760 | // https://github.com/nodejs/node/blob/main/lib/_http_common.js |
no test coverage detected