Skip to content

Commit bd4a9b2

Browse files
committed
fix: Fix response body: from string to json
1 parent 6010f31 commit bd4a9b2

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/api/create.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ pub async fn handler(request: Request<Body>, state: State) -> Result<Response<Bo
2424
return Ok(response);
2525
};
2626

27-
let response = super::build_response(StatusCode::OK, String::from("Success"));
27+
let response = super::build_response(
28+
StatusCode::OK,
29+
serde_json::json!({
30+
"success": true,
31+
})
32+
.to_string(),
33+
);
2834
Ok(response)
2935
}

src/api/delete.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ pub async fn handler(request: Request<Body>, state: State) -> Result<Response<Bo
3636
return Ok(response);
3737
};
3838

39-
let response = super::build_response(StatusCode::OK, format!("Success"));
39+
let response = super::build_response(
40+
StatusCode::OK,
41+
serde_json::json!({
42+
"sucess": true,
43+
})
44+
.to_string(),
45+
);
4046
Ok(response)
4147
}

src/api/kill.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ pub async fn handler(request: Request<Body>, state: State) -> Result<Response<Bo
4545
return Ok(response);
4646
};
4747

48-
let response = build_response(StatusCode::OK, String::from("Success"));
48+
let response = build_response(
49+
StatusCode::OK,
50+
serde_json::json!({
51+
"sucess": true,
52+
})
53+
.to_string(),
54+
);
4955
Ok(response)
5056
}

0 commit comments

Comments
 (0)