Compare commits

..

2 Commits

7 changed files with 27 additions and 36 deletions

16
Cargo.lock generated
View File

@@ -1221,7 +1221,7 @@ dependencies = [
"gobject-sys",
"libc",
"system-deps",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -1563,7 +1563,7 @@ dependencies = [
"libc",
"percent-encoding",
"pin-project-lite",
"socket2 0.6.0",
"socket2 0.5.10",
"tokio",
"tower-service",
"tracing",
@@ -2666,7 +2666,7 @@ dependencies = [
"once_cell",
"socket2 0.5.10",
"tracing",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -3217,13 +3217,11 @@ dependencies = [
[[package]]
name = "serde_qs"
version = "1.0.0-rc.3"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cb0b9062a400c31442e67d1f2b1e7746bebd691110ebee1b7d0c7293b04fab1"
checksum = "f3faaf9e727533a19351a43cc5a8de957372163c7d35cc48c90b75cdda13c352"
dependencies = [
"itoa",
"percent-encoding",
"ryu",
"serde",
"thiserror 2.0.12",
]
@@ -3644,7 +3642,7 @@ dependencies = [
"getrandom 0.3.3",
"once_cell",
"rustix",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -4406,7 +4404,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]

View File

@@ -109,7 +109,7 @@ proc-macro2 = { default-features = false, version = "1.0.96" }
serde = { default-features = false, version = "1.0.219" }
parking_lot = { default-features = false, version = "0.12.4" }
axum = { default-features = false, version = "0.8.4" }
serde_qs = { default-features = false, version = "1.0.0-rc.3" }
serde_qs = { default-features = false, version = "0.15.0" }
syn = { default-features = false, version = "2.0.104" }
xxhash-rust = { default-features = false, version = "0.8.15" }
paste = { default-features = false, version = "1.0.15" }

View File

@@ -287,9 +287,7 @@ where
web_sys::UrlSearchParams::new_with_str_sequence_sequence(form_data)
.unwrap_throw();
let data = data.to_string().as_string().unwrap_or_default();
serde_qs::Config::new()
.use_form_encoding(true)
.deserialize_str::<Self>(&data)
serde_qs::Config::new(5, false).deserialize_str::<Self>(&data)
}
}

View File

@@ -30,8 +30,8 @@ where
})?;
Request::try_new_patch_bytes(
path,
accepts,
Encoding::CONTENT_TYPE,
accepts,
data,
)
}

View File

@@ -28,7 +28,7 @@ where
let data = Encoding::encode(&self).map_err(|e| {
ServerFnErrorErr::Serialization(e.to_string()).into_app_error()
})?;
Request::try_new_post_bytes(path, accepts, Encoding::CONTENT_TYPE, data)
Request::try_new_post_bytes(path, Encoding::CONTENT_TYPE, accepts, data)
}
}

View File

@@ -28,7 +28,7 @@ where
let data = Encoding::encode(&self).map_err(|e| {
ServerFnErrorErr::Serialization(e.to_string()).into_app_error()
})?;
Request::try_new_put_bytes(path, accepts, Encoding::CONTENT_TYPE, data)
Request::try_new_put_bytes(path, Encoding::CONTENT_TYPE, accepts, data)
}
}

View File

@@ -13,7 +13,7 @@ pub struct GetUrl;
/// Pass arguments as the URL-encoded body of a `POST` request.
pub struct PostUrl;
/// Pass arguments as the URL-encoded body of a `DELETE` request.
/// Pass arguments as the URL-encoded query string of a `DELETE` request.
/// **Note**: Browser support for `DELETE` requests without JS/WASM may be poor.
/// Consider using a `POST` request if functionality without JS/WASM is required.
pub struct DeleteUrl;
@@ -46,7 +46,7 @@ where
let data = serde_qs::to_string(&self).map_err(|e| {
ServerFnErrorErr::Serialization(e.to_string()).into_app_error()
})?;
Request::try_new_get(path, accepts, GetUrl::CONTENT_TYPE, &data)
Request::try_new_get(path, GetUrl::CONTENT_TYPE, accepts, &data)
}
}
@@ -58,8 +58,7 @@ where
{
async fn from_req(req: Request) -> Result<Self, E> {
let string_data = req.as_query().unwrap_or_default();
let args = serde_qs::Config::new()
.use_form_encoding(true)
let args = serde_qs::Config::new(5, false)
.deserialize_str::<Self>(string_data)
.map_err(|e| {
ServerFnErrorErr::Args(e.to_string()).into_app_error()
@@ -86,7 +85,7 @@ where
let qs = serde_qs::to_string(&self).map_err(|e| {
ServerFnErrorErr::Serialization(e.to_string()).into_app_error()
})?;
Request::try_new_post(path, accepts, PostUrl::CONTENT_TYPE, qs)
Request::try_new_post(path, PostUrl::CONTENT_TYPE, accepts, qs)
}
}
@@ -98,8 +97,7 @@ where
{
async fn from_req(req: Request) -> Result<Self, E> {
let string_data = req.try_into_string().await?;
let args = serde_qs::Config::new()
.use_form_encoding(true)
let args = serde_qs::Config::new(5, false)
.deserialize_str::<Self>(&string_data)
.map_err(|e| {
ServerFnErrorErr::Args(e.to_string()).into_app_error()
@@ -126,7 +124,7 @@ where
let data = serde_qs::to_string(&self).map_err(|e| {
ServerFnErrorErr::Serialization(e.to_string()).into_app_error()
})?;
Request::try_new_delete(path, accepts, GetUrl::CONTENT_TYPE, &data)
Request::try_new_delete(path, DeleteUrl::CONTENT_TYPE, accepts, &data)
}
}
@@ -138,8 +136,7 @@ where
{
async fn from_req(req: Request) -> Result<Self, E> {
let string_data = req.as_query().unwrap_or_default();
let args = serde_qs::Config::new()
.use_form_encoding(true)
let args = serde_qs::Config::new(5, false)
.deserialize_str::<Self>(string_data)
.map_err(|e| {
ServerFnErrorErr::Args(e.to_string()).into_app_error()
@@ -166,7 +163,7 @@ where
let data = serde_qs::to_string(&self).map_err(|e| {
ServerFnErrorErr::Serialization(e.to_string()).into_app_error()
})?;
Request::try_new_patch(path, accepts, GetUrl::CONTENT_TYPE, data)
Request::try_new_patch(path, PatchUrl::CONTENT_TYPE, accepts, data)
}
}
@@ -177,10 +174,9 @@ where
E: FromServerFnError,
{
async fn from_req(req: Request) -> Result<Self, E> {
let string_data = req.as_query().unwrap_or_default();
let args = serde_qs::Config::new()
.use_form_encoding(true)
.deserialize_str::<Self>(string_data)
let string_data = req.try_into_string().await?;
let args = serde_qs::Config::new(5, false)
.deserialize_str::<Self>(&string_data)
.map_err(|e| {
ServerFnErrorErr::Args(e.to_string()).into_app_error()
})?;
@@ -206,7 +202,7 @@ where
let data = serde_qs::to_string(&self).map_err(|e| {
ServerFnErrorErr::Serialization(e.to_string()).into_app_error()
})?;
Request::try_new_put(path, accepts, GetUrl::CONTENT_TYPE, data)
Request::try_new_put(path, PutUrl::CONTENT_TYPE, accepts, data)
}
}
@@ -217,10 +213,9 @@ where
E: FromServerFnError,
{
async fn from_req(req: Request) -> Result<Self, E> {
let string_data = req.as_query().unwrap_or_default();
let args = serde_qs::Config::new()
.use_form_encoding(true)
.deserialize_str::<Self>(string_data)
let string_data = req.try_into_string().await?;
let args = serde_qs::Config::new(5, false)
.deserialize_str::<Self>(&string_data)
.map_err(|e| {
ServerFnErrorErr::Args(e.to_string()).into_app_error()
})?;