From cf320562181065a5364bf3e4c3021a6120de4b39 Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Fri, 24 Jul 2015 10:42:02 -0700 Subject: [PATCH] Manifest PUT should return 201 Created Change handler, update descriptors table, regenerate API spec, and update test. Signed-off-by: Aaron Lehmann --- docs/spec/api.md | 4 ++-- registry/api/v2/descriptors.go | 2 +- registry/handlers/api_test.go | 4 ++-- registry/handlers/images.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/spec/api.md b/docs/spec/api.md index 483f15f03..e898e77d3 100644 --- a/docs/spec/api.md +++ b/docs/spec/api.md @@ -1258,10 +1258,10 @@ The following parameters should be specified on the request: -###### On Success: Accepted +###### On Success: Created ``` -202 Accepted +201 Created Location: Content-Length: 0 Docker-Content-Digest: diff --git a/registry/api/v2/descriptors.go b/registry/api/v2/descriptors.go index f2551ffeb..d6e37d052 100644 --- a/registry/api/v2/descriptors.go +++ b/registry/api/v2/descriptors.go @@ -523,7 +523,7 @@ var routeDescriptors = []RouteDescriptor{ Successes: []ResponseDescriptor{ { 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{ { Name: "Location", diff --git a/registry/handlers/api_test.go b/registry/handlers/api_test.go index 8d6319417..62a03b62c 100644 --- a/registry/handlers/api_test.go +++ b/registry/handlers/api_test.go @@ -423,7 +423,7 @@ func TestManifestAPI(t *testing.T) { checkErr(t, err, "building manifest url") 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{ "Location": []string{manifestDigestURL}, "Docker-Content-Digest": []string{dgst.String()}, @@ -432,7 +432,7 @@ func TestManifestAPI(t *testing.T) { // -------------------- // Push by digest -- should get same result 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{ "Location": []string{manifestDigestURL}, "Docker-Content-Digest": []string{dgst.String()}, diff --git a/registry/handlers/images.go b/registry/handlers/images.go index e5b0bc772..61eac69ea 100644 --- a/registry/handlers/images.go +++ b/registry/handlers/images.go @@ -183,7 +183,7 @@ func (imh *imageManifestHandler) PutImageManifest(w http.ResponseWriter, r *http w.Header().Set("Location", location) w.Header().Set("Docker-Content-Digest", imh.Digest.String()) - w.WriteHeader(http.StatusAccepted) + w.WriteHeader(http.StatusCreated) } // DeleteImageManifest removes the image with the given tag from the registry.