Skip to content

Instantly share code, notes, and snippets.

@bfontaine
Last active August 24, 2020 10:25
Show Gist options
  • Save bfontaine/a84d19f6ba021bdc71590f81f789217b to your computer and use it in GitHub Desktop.
Save bfontaine/a84d19f6ba021bdc71590f81f789217b to your computer and use it in GitHub Desktop.
Extract cookies off a .har file and export them for the EditThisCookie browser extension for testing purposes
# HAR to EditThisCookie converter
def domain:
.url
| sub("^https?://"; "")
| sub("/.*"; "");
def cookies:
domain as $d
| .cookies|map(. + {"domain": $d,
# Change the values below as needed
"path": "/",
"expirationDate": (now + 86400),
"hostOnly": true,
"sameSite": "no_restriction"});
.log.entries|map(.request|cookies)|flatten(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment