Don't return Body for HEAD requests

This commit is contained in:
Naren Venkataraman 2015-11-01 21:10:37 -05:00
parent 613527db25
commit af915d7c82
1 changed files with 6 additions and 1 deletions

View File

@ -245,7 +245,12 @@ func (handler *Handler) headFile(w http.ResponseWriter, r *http.Request) {
id := r.URL.Query().Get(":id") id := r.URL.Query().Get(":id")
info, err := handler.dataStore.GetInfo(id) info, err := handler.dataStore.GetInfo(id)
if err != nil { 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 return
} }