Merge pull request #45940 from sttts/sttts-204

Automatic merge from submit-queue (batch tested with PRs 42895, 45940)

apiserver: no Status in body for http 204

Fixes http writer errors as with 204 we must not send any body.

Needed downstream for https://github.com/openshift/origin/issues/14213.
pull/6/head
Kubernetes Submit Queue 2017-05-17 03:22:54 -07:00 committed by GitHub
commit e401dc7498
1 changed files with 6 additions and 0 deletions

View File

@ -103,6 +103,12 @@ func ErrorNegotiated(err error, s runtime.NegotiatedSerializer, gv schema.GroupV
delay := strconv.Itoa(int(status.Details.RetryAfterSeconds))
w.Header().Set("Retry-After", delay)
}
if code == http.StatusNoContent {
w.WriteHeader(code)
return code
}
WriteObjectNegotiated(s, gv, w, req, code, status)
return code
}