Render inherited auth and headers (#217)

This commit is contained in:
Gregory Schier
2025-05-26 07:18:57 -07:00
committed by GitHub
parent 261911b57e
commit 7d1ca1c232
7 changed files with 132 additions and 60 deletions
+21
View File
@@ -0,0 +1,21 @@
use crate::error::Result;
use tauri::{Runtime, WebviewWindow};
use yaak_models::models::WebsocketRequest;
use yaak_models::query_manager::QueryManagerExt;
pub(crate) fn resolve_websocket_request<R: Runtime>(
window: &WebviewWindow<R>,
request: &WebsocketRequest,
) -> Result<WebsocketRequest> {
let mut new_request = request.clone();
let (authentication_type, authentication) =
window.db().resolve_auth_for_websocket_request(request)?;
new_request.authentication_type = authentication_type;
new_request.authentication = authentication;
let headers = window.db().resolve_headers_for_websocket_request(request)?;
new_request.headers = headers;
Ok(new_request)
}