MCPcopy
hub / github.com/axios/axios / parseTokens

Function parseTokens

lib/core/AxiosHeaders.js:21–31  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

19}
20
21function parseTokens(str) {
22 const tokens = Object.create(null);
23 const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
24 let match;
25
26 while ((match = tokensRE.exec(str))) {
27 tokens[match[1]] = match[2];
28 }
29
30 return tokens;
31}
32
33const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
34

Callers 1

getMethod · 0.85

Calls 1

createMethod · 0.80

Tested by

no test coverage detected