fix(milvus): send empty JSON body to databases/list endpoint

Follow-up to #2698. The databases/list call posted with no request body,
which the Milvus demo cluster used during testing accepts. Production
Milvus is stricter: a bodyless POST returns HTTP 200 with
`{"code":1801,...}` and omits the `data` field. Since the success check
only inspects the HTTP status, list_milvus_databases() parsed zero names
and silently fell back to `["default"]`, hiding every non-default database
in the sidebar.

Send an empty JSON object `{}` as the body, matching every other Milvus
v2 endpoint. With the body, the endpoint returns code 0 and the full
database list on both demo and production clusters.

Ref #2693

Co-authored-by: 朱豪豪 <zhu.hh.sz@belle.com.cn>
This commit is contained in:
hhzorgand朱豪豪 authored and GitHub committed 2026-07-06 22:04:19 +08:00
1 parent 9ad9261a6d
commit 4024dc6a67
1 file changed
+5 -1
+5 -1
View File
@@ -183,7 +183,11 @@ pub async fn list_databases(client: &VectorClient) -> Result<Vec<String>, String
async fn list_milvus_databases(client: &VectorClient) -> Result<Vec<String>, String> {
// Older Milvus versions (pre-2.2) do not expose the databases endpoint; fall back to "default"
// so the connection stays browsable instead of failing the whole tree load.
let body = match send_json(client.post("/v2/vectordb/databases/list"), "Milvus").await {
//
// The endpoint rejects a bodyless POST with `{"code":1801,...}` (HTTP 200, no `data` field),
// so send an empty JSON object like every other Milvus v2 endpoint.
let body = match send_json(client.post("/v2/vectordb/databases/list").json(&serde_json::json!({})), "Milvus").await
{
Ok(body) => body,
Err(_) => return Ok(vec!["default".to_string()]),
};