Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bool query parameters #2094

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions sdk/src/client/node_api/indexer/query_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ pub trait QueryParameter: Serialize + Send + Sync {

for (field, v) in value.as_object().unwrap().iter() {
if !v.is_null() {
if let Some(v_str) = v.as_str() {
if let Some(v_bool) = v.as_bool() {
if !query_string.is_empty() {
query_string.push('&');
}
query_string.push_str(&format!("{}={}", field, v_str));
}
if let Some(v_u64) = v.as_u64() {
query_string.push_str(&format!("{field}={v_bool}"));
} else if let Some(v_str) = v.as_str() {
if !query_string.is_empty() {
query_string.push('&');
}
query_string.push_str(&format!("{field}={v_str}"));
} else if let Some(v_u64) = v.as_u64() {
if !query_string.is_empty() {
query_string.push('&');
}
query_string.push_str(&format!("{}={}", field, v_u64));
query_string.push_str(&format!("{field}={v_u64}"));
}
}
}
Expand Down
Loading