HEAD shouldn't have any body, handle it in writeErrorResponse()

This commit is contained in:
Harshavardhana committed 2015-07-11 10:34:55 -07:00
1 parent 7fde241ee2
commit 7615a6bfe5
5 files changed
+17 -35

No files matched your search

+5 -2
View File
@@ -201,6 +201,9 @@ func writeErrorResponse(w http.ResponseWriter, req *http.Request, errorType int,
setCommonHeaders(w, getContentTypeString(acceptsContentType), len(encodedErrorResponse))
// write Header
w.WriteHeader(error.HTTPStatusCode)
// write error body
w.Write(encodedErrorResponse)
// HEAD should have no body
if req.Method != "HEAD" {
// write error body
w.Write(encodedErrorResponse)
}
}