File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 11#[ macro_use]
22extern 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]
1010fn rocket ( ) -> _ {
11- rocket:: build ( ) . mount ( "/" , routes ! [ hello ] )
11+ rocket:: build ( ) . mount ( "/" , routes ! [ health_check ] )
1212}
1313
1414#[ cfg( test) ]
1515mod 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}
You can’t perform that action at this time.
0 commit comments