Skip to content

Commit df44c0a

Browse files
committed
feat(query): send X-Database-Id header when current database is set
1 parent d2bf005 commit df44c0a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/api.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub struct ApiClient {
3232
pub api_url: String,
3333
workspace_id: Option<String>,
3434
sandbox_id: Option<String>,
35+
database_id: Option<String>,
3536
}
3637

3738
impl ApiClient {
@@ -117,6 +118,7 @@ impl ApiClient {
117118
}
118119
profile_config.sandbox
119120
}),
121+
database_id: crate::config::load_current_database("default"),
120122
}
121123
}
122124

@@ -129,6 +131,7 @@ impl ApiClient {
129131
api_url: api_url.to_string(),
130132
workspace_id: workspace_id.map(String::from),
131133
sandbox_id: None,
134+
database_id: None,
132135
}
133136
}
134137

@@ -167,6 +170,9 @@ impl ApiClient {
167170
req = req.header("X-Session-Id", sid);
168171
req = req.header("X-Sandbox-Id", sid);
169172
}
173+
if let Some(ref db_id) = self.database_id {
174+
req = req.header("X-Database-Id", db_id);
175+
}
170176
req
171177
}
172178

0 commit comments

Comments
 (0)