diff --git a/macro/src/responsable.rs b/macro/src/responsable.rs index 5b3d253..68b776a 100644 --- a/macro/src/responsable.rs +++ b/macro/src/responsable.rs @@ -22,11 +22,7 @@ pub fn gen_responsable(input: DeriveInput) -> TokenStream { impl #impl_generics axum::response::IntoResponse for #name #generics #where_clause { fn into_response(self) -> axum::http::Response { let mut builder = hyper::Response::builder(); - // .status(#status) // 设置状态码 - // .headers(#headers); // 设置头部信息 - let body = serde_json::to_string(&self).expect("Failed to serialize response"); // 序列化结构体为JSON字符串 - axum::http::Response::new(axum::body::Body::from(body)) // 构建响应 } } @@ -39,12 +35,7 @@ pub fn gen_responsable(input: DeriveInput) -> TokenStream { quote! { impl #impl_generics axum::response::IntoResponse for #name #generics #where_clause { fn into_response(self) -> axum::http::Response { - // let mut builder = hyper::Response::builder(); - // .status(#status) // 设置状态码 - // .headers(#headers); // 设置头部信息 - let body = serde_json::to_string(&self).expect("Failed to serialize response"); // 序列化结构体为JSON字符串 - axum::http::Response::new(axum::body::Body::from(body)) // 构建响应 } } @@ -57,12 +48,7 @@ pub fn gen_responsable(input: DeriveInput) -> TokenStream { quote! { impl #impl_generics axum::response::IntoResponse for #name #generics #where_clause { fn into_response(self) -> axum::http::Response { - // let mut builder = hyper::Response::builder(); - // .status(#status) // 设置状态码 - // .headers(#headers); // 设置头部信息 - let body = serde_json::to_string(&self).expect("Failed to serialize response"); // 序列化结构体为JSON字符串 - axum::http::Response::new(hyper::body::Body::from(body)) // 构建响应 } }