Quotes in header values break almost all snippets for all Chromium HARs
See original GitHub issueFor example, I’m pretty sure this is an entirely valid raw HTTP header:
My-Header: "quoted" 'value'
In almost all cases I’ve seen, httpsnippet inserts this header value literally, without escaping either quote format, but within quotes in the output syntax, and so generating broken output every time, like: headers: { "My-Header": ""quoted" 'value'" }
This is bad because quotes are used in a lot of real HTTP traffic, for example new Chromium versions now send a “sec-ch-ua-platform” header on every single HTTPS request, and the value is always wrapped in quotes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Platform.
That means this breaks almost all snippets from almost all Chrome HAR files, making them all syntactically invalid.
The only cases I’ve seen where this does work is the JS snippets that use stringify-object to build an options object, which generates single-quoted output and automatically escapes any included string quotes en route.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)

Top Related StackOverflow Question
I’ve actually been using my own httpsnippet fork, since the repo seemed abandoned, and in my fork (based on the pre-typescript code unfortunately) @eeWynell added a %q format to the codebuilder that handles quotes automatically, which might be interesting: https://github.com/httptoolkit/httpsnippet/commit/2401900ba1fb04526d2e110cfaf15a119a024083#diff-78e5fb011bd79a6d7b6f88df468aadeac95cf9c8adc86268642815b77f8bfaf2.
That was intended to start fixing some similar issues and add a base to add other new languages, but something similar might help solve this issue here.
As an aside - I’m excited to see the many changes here recently! I’d be very happy to drop my fork and migrate back to the main package, if there’s a chance that it’ll be actively maintained in future. I’m using httpsnippet in HTTP Toolkit. I’d be happy to help with the maintenance work here if there’s any way I can contribute, since I’m using it heavily and currently maintaining my own fork of the same thing anyway, just let me know.
fixed by https://github.com/Kong/httpsnippet/pull/289#issuecomment-1196557392