mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
fix binstalk_downloader::GhApiClient
json deser error (#1193)
When installing `cargo-expand` v1.0.59, I got an error message: ``` Failed to parse http response body as Json: invalid type: null, expected a string at line 1 column 90 ``` This is because `GraphQLPageInfo::end_cursor` can actually be `null`, so I change its type to `Option<CompactString>`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
0813e80438
commit
c4b6921314
1 changed files with 9 additions and 6 deletions
|
@ -289,7 +289,7 @@ struct GraphQLReleaseAssets {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct GraphQLPageInfo {
|
struct GraphQLPageInfo {
|
||||||
#[serde(rename = "endCursor")]
|
#[serde(rename = "endCursor")]
|
||||||
end_cursor: CompactString,
|
end_cursor: Option<CompactString>,
|
||||||
#[serde(rename = "hasNextPage")]
|
#[serde(rename = "hasNextPage")]
|
||||||
has_next_page: bool,
|
has_next_page: bool,
|
||||||
}
|
}
|
||||||
|
@ -376,11 +376,14 @@ query {{
|
||||||
if let Some(assets) = assets {
|
if let Some(assets) = assets {
|
||||||
artifacts.assets.extend(assets.nodes);
|
artifacts.assets.extend(assets.nodes);
|
||||||
|
|
||||||
let page_info = assets.page_info;
|
match assets.page_info {
|
||||||
if !page_info.has_next_page {
|
GraphQLPageInfo {
|
||||||
break Ok(FetchReleaseRet::Artifacts(artifacts));
|
end_cursor: Some(end_cursor),
|
||||||
} else {
|
has_next_page: true,
|
||||||
cond = FilterCondition::After(page_info.end_cursor);
|
} => {
|
||||||
|
cond = FilterCondition::After(end_cursor);
|
||||||
|
}
|
||||||
|
_ => break Ok(FetchReleaseRet::Artifacts(artifacts)),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
break Ok(FetchReleaseRet::ReleaseNotFound);
|
break Ok(FetchReleaseRet::ReleaseNotFound);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue