Add 201/202 to the list of returned codes.

Kubernetes-commit: 449082f55d323bf4acf6963c4d093c044742762c
This commit is contained in:
Brendan Burns 2017-09-26 22:31:19 -07:00 committed by Kubernetes Publisher
parent 6615aaa4d1
commit 5621f05378
1 changed files with 7 additions and 0 deletions

View File

@ -678,6 +678,9 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
Operation("replace"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), mediaTypes...)...).
Returns(http.StatusOK, "OK", producedObject).
// TODO: in some cases, the API may return a v1.Status instead of the versioned object
// but currently go-restful can't handle multiple different objects being returned.
Returns(http.StatusCreated, "Created", producedObject).
Reads(defaultVersionedObject).
Writes(producedObject)
addParams(route, action.Params)
@ -718,6 +721,10 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
Operation("create"+namespaced+kind+strings.Title(subresource)+operationSuffix).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), mediaTypes...)...).
Returns(http.StatusOK, "OK", producedObject).
// TODO: in some cases, the API may return a v1.Status instead of the versioned object
// but currently go-restful can't handle multiple different objects being returned.
Returns(http.StatusCreated, "Created", producedObject).
Returns(http.StatusAccepted, "Accepted", producedObject).
Reads(defaultVersionedObject).
Writes(producedObject)
addParams(route, action.Params)