Skip to content

Commit

Permalink
backend/handler: return json for json internal endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vnghia committed Dec 3, 2024
1 parent 05a7927 commit 8c602ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nghe-proc-macro/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ pub fn handler(attr: TokenStream, item: TokenStream) -> Result<TokenStream, Erro
#[axum::debug_handler]
pub async fn json_handler(
#( #json_args ),*
) -> Result<Vec<u8>, Error> {
) -> Result<axum::Json<<Request as JsonEndpoint>::Response>, Error> {
let response = #ident(#( #pass_args ),*).await?;
Ok(bitcode::serialize(&response)?)
Ok(axum::Json(response))
}
}
}
Expand All @@ -309,7 +309,7 @@ pub fn handler(attr: TokenStream, item: TokenStream) -> Result<TokenStream, Erro
#input

use axum::extract;
use nghe_api::common::{FormEndpoint, SubsonicResponse};
use nghe_api::common::{FormEndpoint, JsonEndpoint, SubsonicResponse};

use crate::auth::{Authorize, BinaryUser, FormGetUser, FormPostUser, JsonUser};

Expand Down

0 comments on commit 8c602ac

Please sign in to comment.