This support depends on the new headers API work coming in PR 8593. Hopefully landing in 7.83.0.
This output is done with -w
and new magic added to its abilties.
Say hello to %header{name}
where name is the case insensitive name of the header withon colon.
$ curl -w '%header{date}\n' -o savefile curl.se
Thu, 17 Mar 2022 16:59:24 GMT
Say hello to %{header_json}
$ curl -sw '%{header_json}\n' -o savefile curl.se | jq
{
"Date": [
"Tue, 09 Nov 2010 14:49:00 GMT"
],
"Server": [
"test-server/fake"
],
"Last-Modified": [
"Tue, 13 Jun 2000 12:10:00 GMT"
],
"ETag": [
"\"21025-dc7-39462498\""
],
"Accept-Ranges": [
"bytes"
],
"Set-Cookie": [
"firstcookie=want; path=/",
"2cookie=want; path=/",
"cookie3=want; path=/"
],
"Content-Length": [
"6"
],
"Connection": [
"close"
]
}