(str)
| 19 | } |
| 20 | |
| 21 | function 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 | |
| 33 | const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); |
| 34 |