Fix error when no facets are specifed

The Modrinth API seemingly doesn't support an empty list for the facets
parameter. This solution simply skips adding that paremeter if it is
empty.
This commit is contained in:
[ ] 2022-12-09 04:18:15 +00:00
parent 74de0d15b3
commit f7ba63b492
1 changed files with 4 additions and 1 deletions

View File

@ -51,7 +51,10 @@ impl HopperClient {
.to_string();
facets.push(package_type_facet);
}
params.push(("facets", format!("[{}]", facets.join(","))));
if !facets.is_empty() {
params.push(("facets", format!("[{}]", facets.join(","))));
}
let url = reqwest::Url::parse_with_params(url.as_str(), &params)?;
info!("GET {}", url);