What does the HEAD method return, and how does it differ from GET?
Quick answer
A HEAD request asks for the response headers a GET request would provide, but not the response content. Use it when you need to inspect metadata, such as Content-Length, without asking for the content itself. A successful HEAD response has no body; if a server sends one anyway, clients should ignore it. Server behavior can affect what you observe, so check the actual response when troubleshooting. [S1]
The question, the details, the next step.
A practical checklist
Decide whether you need metadata or resource content.
Use HEAD to inspect response headers; use GET when you need the content.
Record the request method and resource path.
Note the status and headers actually returned, including Content-Length if present.
Treat a successful HEAD response as bodyless; ignore any body a server sends.
A few more useful answers
Does HEAD return the resource content?
No. It asks for response headers without the response content. A successful HEAD response has no body; if a server sends one, it should be ignored. [S1]
Can I use HEAD to inspect Content-Length?
Yes, a client can use HEAD to inspect metadata such as Content-Length before downloading a resource. The header’s presence or value is not guaranteed by this example. [S1]
Will every server behave exactly like the comparison?
Not necessarily. The semantics describe the intended response, while server behavior may affect what a client observes; check the actual response when troubleshooting. [S1]
Sources
References used for this guide.
- [S1] HEAD request method - HTTP | MDN developer.mozilla.org · Checked
