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:
- $ http example.org Cookie:sessionid=foo
- GET / HTTP/1.1
- Accept: */*
- Accept-Encoding: gzip, deflate
- Connection: keep-alive
- Cookie: sessionid=foo
- Host: example.org
- User-Agent: HTTPie/0.9.9
Send multiple cookies(note the header is quoted to prevent the shell from interpreting the ;
):
- $ http example.org 'Cookie:sessionid=foo;another-cookie=bar'
- GET / HTTP/1.1
- Accept: */*
- Accept-Encoding: gzip, deflate
- Connection: keep-alive
- Cookie: sessionid=foo;another-cookie=bar
- Host: example.org
- User-Agent: HTTPie/0.9.9
If you often deal with cookies in your requests, then chances are you'd appreciatethe sessions feature.