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

Function isValidHTTPToken

lib/core/util.js:752–762  ·  view source on GitHub ↗

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

(characters)

Source from the content-addressed store, hash-verified

750 * @returns {boolean}
751 */
752function isValidHTTPToken (characters) {
753 if (characters.length >= 12) return tokenRegExp.test(characters)
754 if (characters.length === 0) return false
755
756 for (let i = 0; i < characters.length; i++) {
757 if (validTokenChars[characters.charCodeAt(i)] !== 1) {
758 return false
759 }
760 }
761 return true
762}
763
764// headerCharRegex have been lifted from
765// https://github.com/nodejs/node/blob/main/lib/_http_common.js

Callers 6

constructorMethod · 0.85
processHeaderFunction · 0.85
constructorMethod · 0.85
parseCacheControlHeaderFunction · 0.85
parseVaryHeaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected