From f5c01af13f62e63bbf575a35389311e1087234d0 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Tue, 3 Feb 2015 18:27:40 -0800 Subject: [PATCH] Manifest PUT should return 202 Accepted status Signed-off-by: Stephen J Day --- client/client.go | 2 +- registry/api_test.go | 3 +-- registry/images.go | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/client.go b/client/client.go index f303512de..6495da965 100644 --- a/client/client.go +++ b/client/client.go @@ -154,7 +154,7 @@ func (r *clientImpl) PutImageManifest(name, tag string, manifest *manifest.Signe // TODO(bbland): handle other status codes, like 5xx errors switch { - case response.StatusCode == http.StatusOK: + case response.StatusCode == http.StatusOK || response.StatusCode == http.StatusAccepted: return nil case response.StatusCode >= 400 && response.StatusCode < 500: var errors v2.Errors diff --git a/registry/api_test.go b/registry/api_test.go index 5f9e6c386..aa70e504c 100644 --- a/registry/api_test.go +++ b/registry/api_test.go @@ -336,8 +336,7 @@ func TestManifestAPI(t *testing.T) { } resp = putManifest(t, "putting signed manifest", manifestURL, signedManifest) - - checkResponse(t, "putting signed manifest", resp, http.StatusOK) + checkResponse(t, "putting signed manifest", resp, http.StatusAccepted) resp, err = http.Get(manifestURL) if err != nil { diff --git a/registry/images.go b/registry/images.go index 3d6feeed9..db6bd7058 100644 --- a/registry/images.go +++ b/registry/images.go @@ -92,6 +92,8 @@ func (imh *imageManifestHandler) PutImageManifest(w http.ResponseWriter, r *http w.WriteHeader(http.StatusBadRequest) return } + + w.WriteHeader(http.StatusAccepted) } // DeleteImageManifest removes the image with the given tag from the registry.