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

Function create_api_key

crates/server/tests/integration.rs:131–145  ·  view source on GitHub ↗
(client: &reqwest::Client, base_url: &str)

Source from the content-addressed store, hash-verified

129}
130
131async fn create_api_key(client: &reqwest::Client, base_url: &str) -> String {
132 let resp = client
133 .post(format!("{}/api/auth/api-keys", base_url))
134 .json(&json!({ "name": "integration-key" }))
135 .send()
136 .await
137 .expect("POST /api/auth/api-keys failed");
138
139 assert_eq!(resp.status(), 200, "API key creation should succeed");
140 let body: serde_json::Value = resp.json().await.expect("Failed to parse API key response");
141 body["data"]["key"]
142 .as_str()
143 .expect("API key missing")
144 .to_string()
145}
146
147async fn list_audit_entries(client: &reqwest::Client, base_url: &str) -> Vec<serde_json::Value> {
148 let audit_resp = client

Calls 2

sendMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected