MCPcopy Create free account
hub / github.com/nodejs/node / isValidHTTPToken

Function isValidHTTPToken

deps/undici/src/lib/core/util.js:747–757  ·  view source on GitHub ↗

* @param {string} characters * @returns {boolean}

(characters)

Source from the content-addressed store, hash-verified

745 * @returns {boolean}
746 */
747function 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

Callers 3

constructorMethod · 0.70
processHeaderFunction · 0.70
constructorMethod · 0.50

Calls 1

testMethod · 0.45

Tested by

no test coverage detected