Use reason variable

This commit is contained in:
Naren Venkataraman 2015-11-14 12:17:52 -05:00
parent f569ae3f5d
commit a48cf931ae
1 changed files with 6 additions and 4 deletions

View File

@ -453,15 +453,17 @@ func (handler *Handler) sendError(w http.ResponseWriter, r *http.Request, err er
status = 500
}
reason := err.Error()
reason := err.Error() + "\n"
if r.Method == "HEAD" {
reason = ""
}
w.Header().Set("Content-Type", "text/plain")
//https://golang.org/src/net/http/server.go#L1429
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.Header().Set("Content-Length", strconv.Itoa(len(reason)))
w.WriteHeader(status)
w.Write([]byte(err.Error()))
w.Write([]byte(reason))
}
// Make an absolute URLs to the given upload id. If the base path is absolute