mirror of
https://github.com/dathere/ckanaction.git
synced 2026-07-05 17:12:19 +00:00
fix: add entry to multipart form body if value exists
This commit is contained in:
parent
c0e665fbb7
commit
eb199b0b60
1 changed files with 3 additions and 1 deletions
|
|
@ -127,7 +127,9 @@ impl CKAN {
|
||||||
let mut form = reqwest::multipart::Form::new();
|
let mut form = reqwest::multipart::Form::new();
|
||||||
if let Some(body_as_value) = body {
|
if let Some(body_as_value) = body {
|
||||||
for entry in body_as_value.as_object().unwrap().iter() {
|
for entry in body_as_value.as_object().unwrap().iter() {
|
||||||
form = form.text(entry.0.to_owned(), entry.1.as_str().unwrap().to_owned());
|
if let Some(value) = entry.1.as_str() {
|
||||||
|
form = form.text(entry.0.to_owned(), value.to_owned());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
form = form.file("upload", file_pathbuf).await?;
|
form = form.file("upload", file_pathbuf).await?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue