diff --git a/rs-tproxy-controller/src/proxy/uds_server.rs b/rs-tproxy-controller/src/proxy/uds_server.rs index 82dcd4e..5a89010 100644 --- a/rs-tproxy-controller/src/proxy/uds_server.rs +++ b/rs-tproxy-controller/src/proxy/uds_server.rs @@ -30,7 +30,7 @@ impl UdsDataServer { loop { match (&listener).accept().await { Ok((mut stream, addr)) => { - let buf = bincode::serialize(&self.data)?; + let buf = serde_json::to_vec(&self.data)?; tokio::spawn(async move { return match stream.write_all(buf.as_slice()).await { Ok(_) => { diff --git a/rs-tproxy-proxy/src/handler/http/action.rs b/rs-tproxy-proxy/src/handler/http/action.rs index 0ca48fe..d8d3c25 100644 --- a/rs-tproxy-proxy/src/handler/http/action.rs +++ b/rs-tproxy-proxy/src/handler/http/action.rs @@ -99,7 +99,7 @@ pub async fn apply_request_action( append_queries(request.uri_mut(), patch.queries.as_ref())?; if let Some(patch_body) = &patch.body { let PatchBodyActionContents::JSON(ref value) = patch_body.contents; - let mut data = read_value(&mut request.body_mut()).await?; + let mut data = read_value(request.body_mut()).await?; json_patch::merge(&mut data, value); let merged = serde_json::to_vec(&data)?; *request.body_mut() = merged.into(); @@ -216,7 +216,7 @@ pub async fn apply_response_action( if let Some(patch) = &actions.patch { if let Some(patch_body) = &patch.body { let PatchBodyActionContents::JSON(ref value) = patch_body.contents; - let mut data = read_value(&mut response.body_mut()).await?; + let mut data = read_value(response.body_mut()).await?; json_patch::merge(&mut data, value); let merged = serde_json::to_vec(&data)?; *response.body_mut() = merged.into(); diff --git a/rs-tproxy-proxy/src/uds_client.rs b/rs-tproxy-proxy/src/uds_client.rs index e70b205..63cfa5e 100644 --- a/rs-tproxy-proxy/src/uds_client.rs +++ b/rs-tproxy-proxy/src/uds_client.rs @@ -23,7 +23,7 @@ impl UdsDataClient { Ok(_) => { tracing::debug!("Read data successfully."); - match bincode::deserialize(buf.as_slice()) { + match serde_json::from_slice(buf.as_slice()) { Ok(o) => { tracing::debug!("Deserialize data successfully."); Ok(o)