When passing an empty header to isahc
, it is not send inside the request.
It looks like this is the default behavior of curl, but it can be overriden:
$ curl -H 'X-with-value: a value which is preserved' -H 'X-without-value:' https://httpbin.org/get
{
"args": {},
"headers": {
"Accept": "*/*",
"Host": "httpbin.org",
"User-Agent": "curl/7.65.3",
"X-Amzn-Trace-Id": "Root=1-5f157454-942b9837318cfebb67180e01",
"X-With-Value": "a value which is preserved"
},
"origin": "REDACTED",
"url": "https://httpbin.org/get"
}
# but if we add a `-H 'X-without-value;'`, it works
$ curl -H 'X-with-value: a value which is preserved' -H 'X-without-value:' -H 'X-without-value;' https://httpbin.org/get
{
"args": {},
"headers": {
"Accept": "*/*",
"Host": "httpbin.org",
"User-Agent": "curl/7.65.3",
"X-Amzn-Trace-Id": "Root=1-5f157471-2b95cde35a4027182631ca8d",
"X-With-Value": "a value which is preserved",
"X-Without-Value": ""
},
"origin": "REDACTED",
"url": "https://httpbin.org/get"
}