Use reason variable
This commit is contained in:
parent
f569ae3f5d
commit
a48cf931ae
|
@ -453,15 +453,17 @@ func (handler *Handler) sendError(w http.ResponseWriter, r *http.Request, err er
|
||||||
status = 500
|
status = 500
|
||||||
}
|
}
|
||||||
|
|
||||||
reason := err.Error()
|
reason := err.Error() + "\n"
|
||||||
if r.Method == "HEAD" {
|
if r.Method == "HEAD" {
|
||||||
reason = ""
|
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.Header().Set("Content-Length", strconv.Itoa(len(reason)))
|
||||||
w.WriteHeader(status)
|
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
|
// Make an absolute URLs to the given upload id. If the base path is absolute
|
||||||
|
|
Loading…
Reference in New Issue