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)); } }