Don't return Body for HEAD requests
This commit is contained in:
parent
613527db25
commit
af915d7c82
|
@ -245,7 +245,12 @@ func (handler *Handler) headFile(w http.ResponseWriter, r *http.Request) {
|
|||
id := r.URL.Query().Get(":id")
|
||||
info, err := handler.dataStore.GetInfo(id)
|
||||
if err != nil {
|
||||
handler.sendError(w, err)
|
||||
status := http.StatusInternalServerError
|
||||
if os.IsNotExist(err) {
|
||||
status = http.StatusNotFound
|
||||
}
|
||||
w.Header().Set("Content-Length", "0")
|
||||
w.WriteHeader(status)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue