I'm currently writing an unit test to check if http/2
is supported.
Is there a curl
one-liner which checks if http/2
is supported and outputs a response that is easy to parse?
HTTP/2 supported:
$ curl -sI https://curl.haxx.se -o/dev/null -w '%{http_version}\n'
2
HTTP/2 not supported (instead serving 1.1 in this case):
$ curl -sI http://curl.haxx.se -o/dev/null -w '%{http_version}\n'
1.1
(curl 7.50.0 or later is required for this command line to work)