From 8b848a6fc0d8b2b09247cfd07eafd98aefe792b1 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Sun, 8 Jan 2023 13:39:54 +0100 Subject: [PATCH] Rename send_data to send_json_data --- src/mouth.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mouth.rs b/src/mouth.rs index eb49f96..48d8323 100644 --- a/src/mouth.rs +++ b/src/mouth.rs @@ -34,7 +34,7 @@ impl<'a> Mouth<'a> { } /// Send response data in JSON to a client. - fn send_data(&mut self, status_code: Status, data: Value) { + fn send_json_data(&mut self, status_code: Status, data: Value) { let contents = data.to_string(); let length = contents.len(); let response = format!("{status_code}\r\nContent-Type: application/json\r\nContent-Length: {length}\r\n\r\n{contents}"); @@ -47,7 +47,7 @@ impl<'a> Mouth<'a> { where T: Serialize, { - self.send_data(Status::OK, serde_json::json!(data)); + self.send_json_data(Status::OK, serde_json::json!(data)); } /// Send BadRequest response to a client. @@ -62,7 +62,7 @@ impl<'a> Mouth<'a> { data }; - self.send_data(Status::BadRequest, data); + self.send_json_data(Status::BadRequest, data); } /// Send InternalError response to a client. @@ -70,7 +70,7 @@ impl<'a> Mouth<'a> { where T: Serialize, { - self.send_data(Status::InternalError, serde_json::json!(data)); + self.send_json_data(Status::InternalError, serde_json::json!(data)); } /// Send NotFound response to a client. @@ -78,6 +78,6 @@ impl<'a> Mouth<'a> { where T: Serialize, { - self.send_data(Status::NotFound, serde_json::json!(data)); + self.send_json_data(Status::NotFound, serde_json::json!(data)); } }