Most header checks end up as grep on curl -I output. Since curl 7.84 there is a cleaner way: the write-out variable %header{name} gives you one header value.
Name the header in the braces, in any case:
curl -s -o /dev/null -w '%header{cache-control}\n' https://example.com/
curl -s -o /dev/null -w '%{http_code} %header{content-type} %header{server}\n' https://example.com/
The first prints something like max-age=3600 and nothing else. The second combines the status code with two headers on one line. curl strips whitespace and the line ending from the value, so you can compare it in a script directly:
[ "$(curl -s -o /dev/null -w '%header{x-cache}' https://example.com/)" = HIT ] && echo cached
I find it handy to check what a CDN or reverse proxy sends after a config change, for headers like cache-control, age or x-cache.
The value comes from the most recent response. With -L that is the final page, not the redirect. A header that is missing gives an empty string, not an error, so test for that case. If a header appears more than once, look at %{header_json}, which lists every value as an array.
Further reading: curl man page, everything curl: write out
Going deeper: Guide: your Unraid cache is full and Docker stopped, how to find out why and fix it