Request Inheritance (#209)

This commit is contained in:
Gregory Schier
2025-05-23 08:13:25 -07:00
committed by GitHub
parent 13d959799a
commit 4cd2e9cd31
41 changed files with 1031 additions and 403 deletions

View File

@@ -5,6 +5,7 @@ use KeyAndValueRef::{Ascii, Binary};
use tauri::{Manager, Runtime, WebviewWindow};
use yaak_grpc::{KeyAndValueRef, MetadataMap};
use yaak_models::models::GrpcRequest;
use yaak_models::query_manager::QueryManagerExt;
use yaak_plugins::events::{CallHttpAuthenticationRequest, HttpHeader};
use yaak_plugins::manager::PluginManager;
@@ -27,7 +28,8 @@ pub(crate) async fn build_metadata<R: Runtime>(
let mut metadata = BTreeMap::new();
// Add the rest of metadata
for h in request.clone().metadata {
let resolved_metadata = window.db().resolve_metadata_for_grpc_request(&request)?;
for h in resolved_metadata {
if h.name.is_empty() && h.value.is_empty() {
continue;
}
@@ -39,8 +41,11 @@ pub(crate) async fn build_metadata<R: Runtime>(
metadata.insert(h.name, h.value);
}
if let Some(auth_name) = request.authentication_type.clone() {
let auth = request.authentication.clone();
let (authentication_type, authentication) =
window.db().resolve_auth_for_grpc_request(&request)?;
if let Some(auth_name) = authentication_type.clone() {
let auth = authentication.clone();
let plugin_req = CallHttpAuthenticationRequest {
context_id: format!("{:x}", md5::compute(request.id.clone())),
values: serde_json::from_value(serde_json::to_value(&auth).unwrap()).unwrap(),