From f7ba63b492c6c5ca32e2bf742a8046a26a768297 Mon Sep 17 00:00:00 2001 From: "[ ]" Date: Fri, 9 Dec 2022 04:18:15 +0000 Subject: [PATCH] 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. --- src/client.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index a0d9d31..1d3e8ff 100644 --- a/src/client.rs +++ b/src/client.rs @@ -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(), ¶ms)?; info!("GET {}", url);