Parcourir la source

/email endpoint bug fixed

Yurii Sokolovskyi il y a 3 mois
Parent
commit
da1fdb1cd1
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      src/main.rs

+ 3 - 2
src/main.rs

@@ -23,6 +23,7 @@ use axum::extract::Query;
 use axum::{Json, Router};
 #[cfg(not(target_os = "wasi"))]
 use axum::http::Method;
+use axum::response::{IntoResponse, Response};
 #[cfg(not(target_os = "wasi"))]
 use axum::routing::{get, post};
 #[cfg(not(target_os = "wasi"))]
@@ -395,9 +396,9 @@ struct GetEmailQuery {
     id: String,
 }
 #[cfg(not(target_os = "wasi"))]
-async fn get_email_handle(Query(params): Query<GetEmailQuery>) -> Json<String> {
+async fn get_email_handle(Query(params): Query<GetEmailQuery>) -> Response {
     let result: String  = get_email(params.id).await;
-    Json(result)
+    result.into_response()
 }
 
 #[cfg(not(target_os = "wasi"))]