add ability to specify custom http headers in api endpoint (#386)

This commit is contained in:
Adil Hafeez 2025-02-06 11:48:09 -08:00 committed by GitHub
parent e82f8f216f
commit 2bd61d628c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 179 additions and 10 deletions

View file

@ -242,6 +242,7 @@ pub struct EndpointDetails {
pub path: Option<String>,
#[serde(rename = "http_method")]
pub method: Option<HttpMethod>,
pub http_headers: Option<HashMap<String, String>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]

View file

@ -322,6 +322,12 @@ impl StreamContext {
headers.insert(TRACE_PARENT_HEADER, self.traceparent.as_ref().unwrap());
}
// override http headers that are set in the prompt target
let http_headers = endpoint_details.http_headers.clone().unwrap_or_default();
for (key, value) in http_headers.iter() {
headers.insert(key.as_str(), value.as_str());
}
let call_args = CallArgs::new(
ARCH_INTERNAL_CLUSTER_NAME,
&path,