as json fix

This commit is contained in:
MeexReay 2024-11-30 01:37:07 +03:00
parent e281a87258
commit 6d3d1d1cbd
2 changed files with 7 additions and 7 deletions

View File

@ -56,7 +56,7 @@ impl HttpServer for EzSite {
} }
async fn on_start(&self, host: &str) { async fn on_start(&self, host: &str) {
println!("Http server started on {}", host); println!("Http server started on {host}");
} }
async fn on_close(&self) { async fn on_close(&self) {

View File

@ -39,7 +39,7 @@ impl Body {
} }
pub fn as_json(&self) -> Option<Value> { pub fn as_json(&self) -> Option<Value> {
serde_json::to_value(self.as_text()?).ok() serde_json::from_str(&self.as_text()?).ok()
} }
pub fn from_bytes(bytes: &[u8]) -> Body { pub fn from_bytes(bytes: &[u8]) -> Body {