forge
Explore
Log in

Don't you dare go Hollow

🔌 one routes! per path in the ai nest (two GETs cannot share one)

Browse files at this commit

712ff31f765f7a4b37f604b0c40863b440fc9cf0Ahmet Kaan GümüşParent: 5176550
  • fix
    • 🔌 one routes! per path in the ai nest (two GETs cannot share one)
Show full message
fix: 🔌 one routes! per path in the ai nest (two GETs cannot share one)
src/web/ai.rsmodified+11 -2
@@ -1,5 +1,9 @@
11 //! Public discovery for the AI bridge.
22 //!
3+//! Two reads: the bridge's certificate, which a service needs before it can
4+//! dial in, and the capabilities currently on offer, which a client needs
5+//! before it offers an AI feature it cannot get an answer from.
6+//!
37 //! An AI service needs the bridge's certificate before it can dial in, and the
48 //! certificate is regenerated on every boot when no PEM pair is configured. So
59 //! it is published here: the service fetches this over HTTP, pins what it gets,
@@ -14,6 +18,8 @@
1418 //! network, put a real certificate in `AI_TLS_CERT`/`AI_TLS_KEY` and distribute
1519 //! it out of band.
1620
21+use std::collections::BTreeMap;
22+
1723 use axum::Json;
1824 use axum::extract::State;
1925 use base64::Engine;
@@ -27,10 +33,13 @@ use crate::constant::AI_PROTOCOL;
2733 use crate::error::{AppError, ErrorResponse};
2834 use crate::state::AppState;
2935 use crate::web::CurrentUser;
30-use std::collections::BTreeMap;
3136
3237 pub fn routes() -> OpenApiRouter<AppState> {
33- OpenApiRouter::new().routes(routes!(bridge_certificate, capabilities))
38+ // One `routes!` per path: the multi-handler form groups methods under a
39+ // single path, so two `get` handlers never share one.
40+ OpenApiRouter::new()
41+ .routes(routes!(bridge_certificate))
42+ .routes(routes!(capabilities))
3443 }
3544
3645 /// Everything a service needs to reach the bridge, except the shared token