Support blob commit returning a 200 instead of 201

Support registries returning 204 or 200 in place of 201/202.
Ensure body is closed when request is retried.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-08-07 13:55:59 -07:00
parent e4a77fcc0a
commit 48afd44514
2 changed files with 18 additions and 2 deletions

View File

@@ -313,9 +313,11 @@ func (r *dockerBase) doRequestWithRetries(ctx context.Context, req *http.Request
responses = append(responses, resp)
req, err = r.retryRequest(ctx, req, responses)
if err != nil {
resp.Body.Close()
return nil, err
}
if req != nil {
resp.Body.Close()
return r.doRequestWithRetries(ctx, req, responses)
}
return resp, err