Skip to content

Quotes in header values break almost all snippets for all Chromium HARs #271

@pimterry

Description

@pimterry

For 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions