Curl is a useful program used to perform HTTP requests.
In Curl, we can call a HEAD request in various ways, including:
-I
or --head
flag-X HEAD
or --request HEAD
flag-I
flagIn the first case, the program executes a request the same way it would with a GET request, but it will not display its body.
For example, you can have the Content-Length
header without actually having a body. The program just asks for the headers and the closes the connection.
Let’s see an example:
-X HEAD
flagIn the second case, we are going to call a custom method. By default, it won’t print anything.
If we want to make a HEAD
request and print the results, we need to add the -i
flag.
Here is an example: