Cookies

HTTP clients send cookies to the server as regular HTTP headers. That means,HTTPie does not offer any special syntax for specifying cookies — the usualHeader:Value notation is used:

Send a single cookie:

  1. $ http example.org Cookie:sessionid=foo
  1. GET / HTTP/1.1
  2. Accept: */*
  3. Accept-Encoding: gzip, deflate
  4. Connection: keep-alive
  5. Cookie: sessionid=foo
  6. Host: example.org
  7. User-Agent: HTTPie/0.9.9

Send multiple cookies(note the header is quoted to prevent the shell from interpreting the ;):

  1. $ http example.org 'Cookie:sessionid=foo;another-cookie=bar'
  1. GET / HTTP/1.1
  2. Accept: */*
  3. Accept-Encoding: gzip, deflate
  4. Connection: keep-alive
  5. Cookie: sessionid=foo;another-cookie=bar
  6. Host: example.org
  7. User-Agent: HTTPie/0.9.9

If you often deal with cookies in your requests, then chances are you'd appreciatethe sessions feature.