3 ms·
Thanks. Do you have a recommendation on how I should handle HEAD requests? Edit: I went with something like this [1] for now. It worked to solve this problem.
by shurcooL 10y ago
Thanks. Do you have a recommendation on how I should handle HEAD requests?
Edit: I went with something like this [1] for now. It worked to solve this problem. I can adjust later as needed.
[1] https://github.com/shurcooL/home/commit/b4a601ff7a3752feb291535875646c984c3f5634 https://github.com/shurcooL/home/commit/b4a601ff7a3752feb291...
- tyingq 10y agoThe general idea is to return all the same headers as a get, without the body, so that's likely correct. Unless there's code farther down that sends content length, etags, etc. You would want to send those too. Though I don't know that it really matters much.
- shurcooL 10y agoMakes sense, thanks. Good point about Content-Length and ETag headers. So it sounds like one needs to do exactly the same amount of work to respond to a HEAD request as a GET request. Meaning the body still needs to be rendered (to calculate its length and hash). Just not include it in the response.