Update header parsing to allow double-escaped ":" #82
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What Does This PR Do?
Why?
Currently, any header value that contains literal colon characters is blanket rejected by these lines of code. My first impulse as a user was to try escaping those characters. However, I quickly realized that the logic didn't support escaping chars either. This regex split should only select colon characters not preceded by a double escape. Double escape must be used instead of single escape, since JS' strings will infer a regular escape as a standard escape char for the string system and store it without those escape chars.
Questions to Think About 🤔
Negative lookbehind support (which this regex uses) isn't great across older JS versions - I believe ES2018 was when support was added. If compatibility is an issue let me know, and I can probably put together an alternative approach that still allows escaping these chars.