forked from TrueCloudLab/distribution
Merge pull request #141 from stevvooe/put-manifest-http-status
Manifest PUT should return 202 Accepted status
This commit is contained in:
commit
d7c62e06f4
3 changed files with 4 additions and 3 deletions
|
@ -154,7 +154,7 @@ func (r *clientImpl) PutImageManifest(name, tag string, manifest *manifest.Signe
|
||||||
|
|
||||||
// TODO(bbland): handle other status codes, like 5xx errors
|
// TODO(bbland): handle other status codes, like 5xx errors
|
||||||
switch {
|
switch {
|
||||||
case response.StatusCode == http.StatusOK:
|
case response.StatusCode == http.StatusOK || response.StatusCode == http.StatusAccepted:
|
||||||
return nil
|
return nil
|
||||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
var errors v2.Errors
|
var errors v2.Errors
|
||||||
|
|
|
@ -336,8 +336,7 @@ func TestManifestAPI(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
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.StatusOK)
|
|
||||||
|
|
||||||
resp, err = http.Get(manifestURL)
|
resp, err = http.Get(manifestURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -92,6 +92,8 @@ func (imh *imageManifestHandler) PutImageManifest(w http.ResponseWriter, r *http
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w.WriteHeader(http.StatusAccepted)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteImageManifest removes the image with the given tag from the registry.
|
// DeleteImageManifest removes the image with the given tag from the registry.
|
||||||
|
|
Loading…
Reference in a new issue