4 ms·
"The HTTP HEAD method requests the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method. ". So it goes agains
by buzzdenver 3y ago
"The HTTP HEAD method requests the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method. ". So it goes against the HTTP spec.
- kjksf 3y agoIn practice much bigger practical problem is that no-one handles HEAD. I sure don't. And those that do probably aren't careful about HTTP headers either. So in practice this an improvement for most. And if you don't like how it works, there are plenty of alternatives to use.
- iudqnolq 3y agoGo implicitly buffers the first 512 bytes to sniff a content-type header so it's no like the status quo is free of arguably incorrect magic.
- cowl 3y agoHow does it go against the HTTP Spec. The HEAD method could be autoregistered for all handlers of GET Requests and library makes sure no body is sent (Basically it's a autoregistered middleware that wraps the get handler and overwrites the reponse writer with an empty body.) Arguably this is more correct that letting the users declare a separate Handler that can neither guarantee the same headers as the the GET Handler not guarantee that the body is not sent the response.