Skip to content

Instantly share code, notes, and snippets.

@cbfrance
Created June 16, 2021 21:36
Show Gist options
  • Save cbfrance/cdb547897e56b143ab6ab41a8eebae85 to your computer and use it in GitHub Desktop.
Save cbfrance/cdb547897e56b143ab6ab41a8eebae85 to your computer and use it in GitHub Desktop.
http csrf with httpie
# Get csrf token from header
# shell function, add to .zshrc
# Requires httpie: brew install httpie
function httpl() {
csrf=`http $1 -h | grep -Po '(?<=csrftoken=)[^;]*(?=;)'`
http -f POST $* X-CsrfToken:$csrf
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment