Implemented proxying of GSD requests
This commit is contained in:
26
src/api.rs
Normal file
26
src/api.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use crate::middleware::AppState;
|
||||
use axum::Extension;
|
||||
use axum::extract::Request;
|
||||
use axum::response::IntoResponse;
|
||||
use http::StatusCode;
|
||||
use log::error;
|
||||
use std::sync::Arc;
|
||||
use axum::body::Body;
|
||||
|
||||
pub async fn handle_post(
|
||||
Extension(state): Extension<Arc<AppState>>,
|
||||
request: Request<Body>,
|
||||
) -> impl IntoResponse {
|
||||
match state.clone().gsd_service.forward_post_request(request).await {
|
||||
Ok(e) => e.text().await.unwrap().into_response(),
|
||||
|
||||
Err(e) => {
|
||||
error!("Failed to forward post: {:?}", e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR.into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn handle_login() -> impl IntoResponse {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user