Merge pull request #744 from aaronlehmann/manifest-put-response-code

Manifest PUT should return 201 Created
This commit is contained in:
Derek McGowan 2015-07-28 10:42:54 -07:00
commit 0355c3026c
4 changed files with 6 additions and 6 deletions

View file

@ -1573,10 +1573,10 @@ The following parameters should be specified on the request:
###### On Success: Accepted ###### On Success: Created
``` ```
202 Accepted 201 Created
Location: <url> Location: <url>
Content-Length: 0 Content-Length: 0
Docker-Content-Digest: <digest> Docker-Content-Digest: <digest>

View file

@ -607,7 +607,7 @@ var routeDescriptors = []RouteDescriptor{
Successes: []ResponseDescriptor{ Successes: []ResponseDescriptor{
{ {
Description: "The manifest has been accepted by the registry and is stored under the specified `name` and `tag`.", Description: "The manifest has been accepted by the registry and is stored under the specified `name` and `tag`.",
StatusCode: http.StatusAccepted, StatusCode: http.StatusCreated,
Headers: []ParameterDescriptor{ Headers: []ParameterDescriptor{
{ {
Name: "Location", Name: "Location",

View file

@ -810,7 +810,7 @@ func testManifestAPI(t *testing.T, env *testEnv, args manifestArgs) (*testEnv, m
checkErr(t, err, "building manifest url") checkErr(t, err, "building manifest url")
resp = putManifest(t, "putting signed manifest", manifestURL, signedManifest) resp = putManifest(t, "putting signed manifest", manifestURL, signedManifest)
checkResponse(t, "putting signed manifest", resp, http.StatusAccepted) checkResponse(t, "putting signed manifest", resp, http.StatusCreated)
checkHeaders(t, resp, http.Header{ checkHeaders(t, resp, http.Header{
"Location": []string{manifestDigestURL}, "Location": []string{manifestDigestURL},
"Docker-Content-Digest": []string{dgst.String()}, "Docker-Content-Digest": []string{dgst.String()},
@ -819,7 +819,7 @@ func testManifestAPI(t *testing.T, env *testEnv, args manifestArgs) (*testEnv, m
// -------------------- // --------------------
// Push by digest -- should get same result // Push by digest -- should get same result
resp = putManifest(t, "putting signed manifest", manifestDigestURL, signedManifest) resp = putManifest(t, "putting signed manifest", manifestDigestURL, signedManifest)
checkResponse(t, "putting signed manifest", resp, http.StatusAccepted) checkResponse(t, "putting signed manifest", resp, http.StatusCreated)
checkHeaders(t, resp, http.Header{ checkHeaders(t, resp, http.Header{
"Location": []string{manifestDigestURL}, "Location": []string{manifestDigestURL},
"Docker-Content-Digest": []string{dgst.String()}, "Docker-Content-Digest": []string{dgst.String()},

View file

@ -183,7 +183,7 @@ func (imh *imageManifestHandler) PutImageManifest(w http.ResponseWriter, r *http
w.Header().Set("Location", location) w.Header().Set("Location", location)
w.Header().Set("Docker-Content-Digest", imh.Digest.String()) w.Header().Set("Docker-Content-Digest", imh.Digest.String())
w.WriteHeader(http.StatusAccepted) w.WriteHeader(http.StatusCreated)
} }
// DeleteImageManifest removes the manifest with the given digest from the registry. // DeleteImageManifest removes the manifest with the given digest from the registry.