MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / query_rejects_invalid_bearer

Function query_rejects_invalid_bearer

nodedb/tests/http_query.rs:81–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79
80#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
81async fn query_rejects_invalid_bearer() {
82 let srv = start_http(AuthMode::Password).await;
83 let url = format!("http://{}/v1/query", srv.local_addr);
84 let resp = reqwest::Client::new()
85 .post(&url)
86 .header("Authorization", "Bearer ndb_bogus")
87 .json(&serde_json::json!({"sql": "SELECT 1"}))
88 .send()
89 .await
90 .expect("POST /v1/query");
91 assert_eq!(
92 resp.status(),
93 reqwest::StatusCode::UNAUTHORIZED,
94 "/v1/query must reject invalid bearer tokens"
95 );
96}
97
98// ─── /v1/query — malformed request ───────────────────────────────────────────
99

Callers

nothing calls this directly

Calls 4

start_httpFunction · 0.70
expectMethod · 0.45
sendMethod · 0.45
headerMethod · 0.45

Tested by

no test coverage detected