fix: add default headers only to new workspaces on insert (#356)

This commit is contained in:
Gregory Schier
2026-01-09 17:18:09 -08:00
committed by GitHub
parent 4c8f768624
commit 6654d6c346

View File

@@ -65,7 +65,28 @@ impl<'a> DbContext<'a> {
} }
pub fn upsert_workspace(&self, w: &Workspace, source: &UpdateSource) -> Result<Workspace> { pub fn upsert_workspace(&self, w: &Workspace, source: &UpdateSource) -> Result<Workspace> {
self.upsert(w, source) let mut workspace = w.clone();
// Add default headers only for NEW workspaces (empty ID means insert, not update)
// This prevents re-adding headers if a user intentionally removes all headers
if workspace.id.is_empty() && workspace.headers.is_empty() {
workspace.headers = vec![
HttpRequestHeader {
enabled: true,
name: "User-Agent".to_string(),
value: "yaak".to_string(),
id: None,
},
HttpRequestHeader {
enabled: true,
name: "Accept".to_string(),
value: "*/*".to_string(),
id: None,
},
];
}
self.upsert(&workspace, source)
} }
pub fn resolve_auth_for_workspace( pub fn resolve_auth_for_workspace(