MCPcopy Index your code
hub / github.com/nodejs/node / isValidHTTPToken

Function isValidHTTPToken

deps/undici/undici.js:2282–2291  ·  view source on GitHub ↗
(characters)

Source from the content-addressed store, hash-verified

2280 __name(isTokenCharCode, "isTokenCharCode");
2281 var tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
2282 function isValidHTTPToken(characters) {
2283 if (characters.length >= 12) return tokenRegExp.test(characters);
2284 if (characters.length === 0) return false;
2285 for (let i = 0; i < characters.length; i++) {
2286 if (validTokenChars[characters.charCodeAt(i)] !== 1) {
2287 return false;
2288 }
2289 }
2290 return true;
2291 }
2292 __name(isValidHTTPToken, "isValidHTTPToken");
2293 var headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
2294 function isValidHeaderValue(characters) {

Callers 3

constructorMethod · 0.70
processHeaderFunction · 0.70
constructorMethod · 0.70

Calls 1

testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…