A HEAD request asks for a resource's headers without its body - browsers and caches use it to check things cheaply. Today you serve HEAD as a GET with the body stripped off.
Answer a HEAD request with the same status and headers as the GET, but no body.
A HEAD request is a GET that returns everything except the body: same
status, same headers — crucially the same Content-Length — but zero body bytes.
Clients use it to check whether a resource changed, or how big it is, without
paying to download it.
The clean way to implement it is to route the request as though it were a GET,
then blank the body on the way out. Keep Content-Length reporting what the body
would have been — that is the whole value of a HEAD. Mind the interaction with
your serializer: if it derives Content-Length from the body, blanking the body
would zero it, so set the length explicitly from the GET body first (this is
why the serializer only fills in a Content-Length the caller has not already
set).
resp := m.dispatch(asGet(r)) // route it as if it were GETif r.Method == "HEAD" {resp.Body = nil // keep Content-Length, drop the bytes}