Relax status code acceptance (#281)

* Relax status code acceptance

Fixes #273

* added a comment
This commit is contained in:
Fedor Korotkov
2022-10-17 21:42:25 +04:00
committed by GitHub
parent 36bb68a72d
commit af7530ee50
+2 -2
View File
@@ -214,8 +214,8 @@ class Registry {
parameters: lastChunk ? ["digest": digest] : [:],
body: chunk
)
let expectedStatus = lastChunk ? HTTPCode.Created.rawValue : HTTPCode.Accepted.rawValue
if response.statusCode != expectedStatus {
// always accept both statuses since AWS ECR is not following specification
if response.statusCode != HTTPCode.Created.rawValue && response.statusCode != HTTPCode.Accepted.rawValue {
throw RegistryError.UnexpectedHTTPStatusCode(when: "streaming blob to \(uploadLocation)",
code: response.statusCode, details: data.asText())
}