Skip to content

Commit 1e7ab42

Browse files
bincode -> json (#27)
* bincode -> json Signed-off-by: andrewmatilde <[email protected]> * fix lint Signed-off-by: andrewmatilde <[email protected]>
1 parent 88022e5 commit 1e7ab42

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

rs-tproxy-controller/src/proxy/uds_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl<T: serde::ser::Serialize> UdsDataServer<T> {
3030
loop {
3131
match (&listener).accept().await {
3232
Ok((mut stream, addr)) => {
33-
let buf = bincode::serialize(&self.data)?;
33+
let buf = serde_json::to_vec(&self.data)?;
3434
tokio::spawn(async move {
3535
return match stream.write_all(buf.as_slice()).await {
3636
Ok(_) => {

rs-tproxy-proxy/src/handler/http/action.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub async fn apply_request_action(
9999
append_queries(request.uri_mut(), patch.queries.as_ref())?;
100100
if let Some(patch_body) = &patch.body {
101101
let PatchBodyActionContents::JSON(ref value) = patch_body.contents;
102-
let mut data = read_value(&mut request.body_mut()).await?;
102+
let mut data = read_value(request.body_mut()).await?;
103103
json_patch::merge(&mut data, value);
104104
let merged = serde_json::to_vec(&data)?;
105105
*request.body_mut() = merged.into();
@@ -216,7 +216,7 @@ pub async fn apply_response_action(
216216
if let Some(patch) = &actions.patch {
217217
if let Some(patch_body) = &patch.body {
218218
let PatchBodyActionContents::JSON(ref value) = patch_body.contents;
219-
let mut data = read_value(&mut response.body_mut()).await?;
219+
let mut data = read_value(response.body_mut()).await?;
220220
json_patch::merge(&mut data, value);
221221
let merged = serde_json::to_vec(&data)?;
222222
*response.body_mut() = merged.into();

rs-tproxy-proxy/src/uds_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl UdsDataClient {
2323
Ok(_) => {
2424
tracing::debug!("Read data successfully.");
2525

26-
match bincode::deserialize(buf.as_slice()) {
26+
match serde_json::from_slice(buf.as_slice()) {
2727
Ok(o) => {
2828
tracing::debug!("Deserialize data successfully.");
2929
Ok(o)

0 commit comments

Comments
 (0)