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

This commit is contained in:
Harshavardhana
2015-07-10 21:06:43 -07:00
parent 7fde241ee2
commit 7615a6bfe5
5 changed files with 17 additions and 35 deletions

View File

@@ -162,12 +162,7 @@ func IgnoreResourcesHandler(h http.Handler) http.Handler {
func (h resourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
acceptsContentType := getContentType(r)
if ignoreNotImplementedObjectResources(r) || ignoreNotImplementedBucketResources(r) {
error := getErrorCode(NotImplemented)
errorResponse := getErrorResponse(error, "")
encodeErrorResponse := encodeErrorResponse(errorResponse, acceptsContentType)
setCommonHeaders(w, getContentTypeString(acceptsContentType), len(encodeErrorResponse))
w.WriteHeader(error.HTTPStatusCode)
w.Write(encodeErrorResponse)
writeErrorResponse(w, r, NotImplemented, acceptsContentType, r.URL.Path)
return
}
h.handler.ServeHTTP(w, r)