Skip to content

Commit cfde571

Browse files
authored
Merge pull request #11 from Bibimbap-Team/2-implement-feature-for-health-check
Implement feature for health check
2 parents 093d76c + 722befb commit cfde571

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/main.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
#[macro_use]
22
extern crate rocket;
33

4-
#[get("/")]
5-
fn hello() -> &'static str {
6-
"Hello, world!"
4+
#[get("/health_check")]
5+
fn health_check() {
6+
()
77
}
88

99
#[launch]
1010
fn rocket() -> _ {
11-
rocket::build().mount("/", routes![hello])
11+
rocket::build().mount("/", routes![health_check])
1212
}
1313

1414
#[cfg(test)]
1515
mod test {
1616
use super::rocket;
1717
use rocket::http::Status;
1818
use rocket::local::blocking::Client;
19+
use std::io::Read;
1920

2021
#[test]
21-
fn test_hello() {
22-
let client = Client::tracked(rocket()).expect("valid rocket instance");
23-
let response = client.get(uri!(super::hello)).dispatch();
22+
fn health_check_works() {
23+
let client = Client::tracked(rocket()).expect("Failed to create client");
24+
let response = client.get(uri!(super::health_check)).dispatch();
2425

2526
assert_eq!(response.status(), Status::Ok);
26-
assert_eq!(response.into_string().unwrap(), "Hello, world!");
27+
assert_eq!(response.bytes().count(), 0);
2728
}
2829
}

0 commit comments

Comments
 (0)