MCPcopy Create free account
hub / github.com/ZingerLittleBee/ServerBee / create_api_key

Function create_api_key

crates/server/tests/docker_integration.rs:112–126  ·  view source on GitHub ↗
(client: &Client, base_url: &str)

Source from the content-addressed store, hash-verified

110 .expect("Login request failed");
111
112 assert_eq!(resp.status(), 200, "Login should succeed");
113}
114
115async fn create_api_key(client: &Client, base_url: &str) -> String {
116 let resp = client
117 .post(format!("{}/api/auth/api-keys", base_url))
118 .json(&json!({ "name": "docker-test-key" }))
119 .send()
120 .await
121 .expect("POST /api/auth/api-keys failed");
122
123 assert_eq!(resp.status(), 200, "API key creation should succeed");
124 let body: serde_json::Value = resp.json().await.expect("Failed to parse API key response");
125 body["data"]["key"]
126 .as_str()
127 .expect("API key missing")
128 .to_string()
129}

Calls 2

sendMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected