@@ -5,23 +5,23 @@ pub async fn json(ctx: Context) {
55 "message" : RESPONSEDATA_STR
66 } ) ;
77 let _ = ctx
8- . set_response_body ( serde_json:: to_string ( & json) . unwrap_or_default ( ) )
8+ . send_response ( 200 , serde_json:: to_string ( & json) . unwrap_or_default ( ) )
99 . await ;
1010}
1111
1212pub async fn plaintext ( ctx : Context ) {
1313 let _ = ctx
1414 . set_response_header ( CONTENT_TYPE , TEXT_PLAIN )
1515 . await
16- . set_response_body ( RESPONSEDATA_BIN )
16+ . send_response ( 200 , RESPONSEDATA_BIN )
1717 . await ;
1818}
1919
2020pub async fn db ( ctx : Context ) {
2121 let db_connection: & DbPoolConnection = get_db_connection ( ) ;
2222 let query_row: QueryRow = random_world_row ( db_connection) . await ;
2323 let _ = ctx
24- . set_response_body ( serde_json:: to_string ( & query_row) . unwrap_or_default ( ) )
24+ . send_response ( 200 , serde_json:: to_string ( & query_row) . unwrap_or_default ( ) )
2525 . await ;
2626}
2727
@@ -36,7 +36,7 @@ pub async fn queries(ctx: Context) {
3636 let db_pool: & DbPoolConnection = get_db_connection ( ) ;
3737 let data: Vec < QueryRow > = get_some_row_id ( queries, db_pool) . await ;
3838 let _ = ctx
39- . set_response_body ( serde_json:: to_string ( & data) . unwrap_or_default ( ) )
39+ . send_response ( 200 , serde_json:: to_string ( & data) . unwrap_or_default ( ) )
4040 . await ;
4141}
4242
@@ -56,9 +56,10 @@ pub async fn fortunes(ctx: Context) {
5656 ) ) ;
5757 fortunes_list. sort_by ( |it, next| it. message . cmp ( & next. message ) ) ;
5858 let res: String = FortunesTemplate :: new ( fortunes_list) . to_string ( ) ;
59- ctx. set_response_header ( CONTENT_TYPE , content_type_charset ( TEXT_HTML , UTF8 ) )
59+ let _ = ctx
60+ . set_response_header ( CONTENT_TYPE , content_type_charset ( TEXT_HTML , UTF8 ) )
6061 . await
61- . set_response_body ( res)
62+ . send_response ( 200 , res)
6263 . await ;
6364}
6465
@@ -72,7 +73,7 @@ pub async fn updates(ctx: Context) {
7273 . max ( 1 ) ;
7374 let res: Vec < QueryRow > = update_world_rows ( queries) . await ;
7475 let _ = ctx
75- . set_response_body ( serde_json:: to_string ( & res) . unwrap_or_default ( ) )
76+ . send_response ( 200 , serde_json:: to_string ( & res) . unwrap_or_default ( ) )
7677 . await ;
7778}
7879
@@ -86,6 +87,6 @@ pub async fn cached_queries(ctx: Context) {
8687 . max ( 1 ) ;
8788 let res: Vec < QueryRow > = CACHE . iter ( ) . take ( count as usize ) . cloned ( ) . collect ( ) ;
8889 let _ = ctx
89- . set_response_body ( serde_json:: to_string ( & res) . unwrap_or_default ( ) )
90+ . send_response ( 200 , serde_json:: to_string ( & res) . unwrap_or_default ( ) )
9091 . await ;
9192}
0 commit comments