chore: relax HTTP header name validation to match RFC 7230
Updated the regex in `src/helpers.ts` to allow all valid characters in an HTTP token (RFC 7230, section 3.2.6), including symbols like `_`, `.`, `!`, and `*`. Previously, the validation was overly restrictive, only allowing alphanumeric characters and hyphens. Also updated the corresponding unit test in `__tests__/helpers.test.ts` to reflect the change.
This commit is contained in:
@@ -214,13 +214,11 @@ valid123: value5`
|
||||
|
||||
expect(result).toEqual({
|
||||
'valid-header': 'value1',
|
||||
invalid_underscore: 'value3',
|
||||
valid123: 'value5',
|
||||
})
|
||||
|
||||
expect(core.warning).toHaveBeenCalledWith(expect.stringContaining('Skipping invalid header name: invalid header'))
|
||||
expect(core.warning).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Skipping invalid header name: invalid_underscore'),
|
||||
)
|
||||
expect(core.warning).toHaveBeenCalledWith(expect.stringContaining('Skipping invalid header name: invalid@header'))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user