mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 16:21:25 +02:00
Fix multipart files
This commit is contained in:
@@ -290,7 +290,7 @@ pub async fn send_http_request(
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let name = render::render(name_raw, &workspace, environment_ref);
|
let name = render::render(name_raw, &workspace, environment_ref);
|
||||||
let part = if file_path.is_empty() {
|
let mut part = if file_path.is_empty() {
|
||||||
multipart::Part::text(render::render(
|
multipart::Part::text(render::render(
|
||||||
value_raw,
|
value_raw,
|
||||||
&workspace,
|
&workspace,
|
||||||
@@ -311,23 +311,24 @@ pub async fn send_http_request(
|
|||||||
.as_str()
|
.as_str()
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
multipart_form = multipart_form.part(
|
if !ct_raw.is_empty() {
|
||||||
name,
|
let content_type = render::render(ct_raw, &workspace, environment_ref);
|
||||||
if ct_raw.is_empty() {
|
part = part
|
||||||
part
|
.mime_str(content_type.as_str())
|
||||||
} else {
|
.map_err(|e| e.to_string())?;
|
||||||
let content_type = render::render(ct_raw, &workspace, environment_ref);
|
}
|
||||||
let filename = PathBuf::from(file_path)
|
|
||||||
.file_name()
|
if !file_path.is_empty() {
|
||||||
.unwrap_or_default()
|
let filename = PathBuf::from(file_path)
|
||||||
.to_str()
|
.file_name()
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.to_string();
|
.to_str()
|
||||||
part.file_name(filename)
|
.unwrap_or_default()
|
||||||
.mime_str(content_type.as_str())
|
.to_string();
|
||||||
.map_err(|e| e.to_string())?
|
part = part.file_name(filename);
|
||||||
},
|
}
|
||||||
);
|
|
||||||
|
multipart_form = multipart_form.part(name, part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
headers.remove("Content-Type"); // reqwest will add this automatically
|
headers.remove("Content-Type"); // reqwest will add this automatically
|
||||||
|
|||||||
Reference in New Issue
Block a user