diff --git a/docs/spec/api.md b/docs/spec/api.md index 60ce1864..3971e209 100644 --- a/docs/spec/api.md +++ b/docs/spec/api.md @@ -1573,10 +1573,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 635cb7f9..74bdb9f2 100644 --- a/registry/api/v2/descriptors.go +++ b/registry/api/v2/descriptors.go @@ -607,7 +607,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 c73cbdc7..4b16127f 100644 --- a/registry/handlers/api_test.go +++ b/registry/handlers/api_test.go @@ -810,7 +810,7 @@ func testManifestAPI(t *testing.T, env *testEnv, args manifestArgs) (*testEnv, m 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()}, @@ -819,7 +819,7 @@ func testManifestAPI(t *testing.T, env *testEnv, args manifestArgs) (*testEnv, m // -------------------- // 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 452dffaf..01f9b7a2 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 manifest with the given digest from the registry.