Actually use the tested token parser for the registry challenge
The call site still deserialized into a struct whose serde alias breaks on Docker Hub, which sends token and access_token; every Hub image therefore reported that no token was returned. The integration test now answers with both fields so the call site is covered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@ -152,14 +152,7 @@ impl ImageRegistry for CurlImageRegistry {
|
|||||||
DomainError::Unavailable(format!("{host}: authentication required"))
|
DomainError::Unavailable(format!("{host}: authentication required"))
|
||||||
})?;
|
})?;
|
||||||
let (_, _, token_body) = self.get(&challenge, None).await?;
|
let (_, _, token_body) = self.get(&challenge, None).await?;
|
||||||
#[derive(serde::Deserialize)]
|
token = parse_token(&token_body);
|
||||||
struct Token {
|
|
||||||
#[serde(alias = "access_token")]
|
|
||||||
token: Option<String>,
|
|
||||||
}
|
|
||||||
token = serde_json::from_str::<Token>(&token_body)
|
|
||||||
.ok()
|
|
||||||
.and_then(|t| t.token);
|
|
||||||
if token.is_none() {
|
if token.is_none() {
|
||||||
return Err(DomainError::Unavailable(format!(
|
return Err(DomainError::Unavailable(format!(
|
||||||
"{host}: no token in the auth response"
|
"{host}: no token in the auth response"
|
||||||
|
|||||||
Reference in New Issue
Block a user