Skip to content

Commit cc35608

Browse files
authored
fix(core): do not serialize strings in http api form, closes #3910 (#3928)
1 parent 395a259 commit cc35608

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

.changes/fix-form-serialization.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Fixes the HTTP API form text fields.

.changes/remove-form-part-file.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
**Breaking change:** Removed `tauri::api::http::FormPart::File`.

core/tauri/src/api/http.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use serde_json::Value;
1111
use serde_repr::{Deserialize_repr, Serialize_repr};
1212
use url::Url;
1313

14-
use std::{collections::HashMap, path::PathBuf, time::Duration};
14+
use std::{collections::HashMap, time::Duration};
1515

1616
/// The builder of [`Client`].
1717
#[derive(Debug, Clone, Default, Deserialize)]
@@ -129,7 +129,6 @@ impl Client {
129129
for (name, part) in form_body.0 {
130130
match part {
131131
FormPart::Bytes(bytes) => form.push((name, serde_json::to_string(&bytes)?)),
132-
FormPart::File(file_path) => form.push((name, serde_json::to_string(&file_path)?)),
133132
FormPart::Text(text) => form.push((name, text)),
134133
}
135134
}
@@ -176,7 +175,6 @@ impl Client {
176175
for (name, part) in form_body.0 {
177176
match part {
178177
FormPart::Bytes(bytes) => form.push((name, serde_json::to_string(&bytes)?)),
179-
FormPart::File(file_path) => form.push((name, serde_json::to_string(&file_path)?)),
180178
FormPart::Text(text) => form.push((name, text)),
181179
}
182180
}
@@ -222,8 +220,6 @@ pub enum ResponseType {
222220
#[serde(untagged)]
223221
#[non_exhaustive]
224222
pub enum FormPart {
225-
/// A file path value.
226-
File(PathBuf),
227223
/// A string value.
228224
Text(String),
229225
/// A byte array value.

0 commit comments

Comments
 (0)