Fix auth none

This commit is contained in:
Gregory Schier
2025-05-23 08:43:52 -07:00
parent 31605881ac
commit 4d1dda0786

View File

@@ -226,30 +226,38 @@ pub(crate) async fn connect<R: Runtime>(
); );
} }
if let Some(auth_name) = authentication_type.clone() { match authentication_type {
let auth = authentication.clone(); None => {
let plugin_req = CallHttpAuthenticationRequest { // No authentication found. Not even inherited
context_id: format!("{:x}", md5::compute(request_id.to_string())), }
values: serde_json::from_value(serde_json::to_value(&auth).unwrap()).unwrap(), Some(authentication_type) if authentication_type == "none" => {
method: "POST".to_string(), // Explicitly no authentication
url: request.url.clone(), }
headers: request Some(authentication_type) => {
.headers let auth = authentication.clone();
.clone() let plugin_req = CallHttpAuthenticationRequest {
.into_iter() context_id: format!("{:x}", md5::compute(request_id.to_string())),
.map(|h| HttpHeader { values: serde_json::from_value(serde_json::to_value(&auth).unwrap()).unwrap(),
name: h.name, method: "POST".to_string(),
value: h.value, url: request.url.clone(),
}) headers: request
.collect(), .headers
}; .clone()
let plugin_result = .into_iter()
plugin_manager.call_http_authentication(&window, &auth_name, plugin_req).await?; .map(|h| HttpHeader {
for header in plugin_result.set_headers { name: h.name,
headers.insert( value: h.value,
HeaderName::from_str(&header.name).unwrap(), })
HeaderValue::from_str(&header.value).unwrap(), .collect(),
); };
let plugin_result =
plugin_manager.call_http_authentication(&window, &authentication_type, plugin_req).await?;
for header in plugin_result.set_headers {
headers.insert(
HeaderName::from_str(&header.name).unwrap(),
HeaderValue::from_str(&header.value).unwrap(),
);
}
} }
} }