(
_state: State<Arc<ServerState>>,
Path(name): Path<String>,
Json(req): Json<PluginAuthFetchRequest>,
)
| 4684 | } |
| 4685 | |
| 4686 | async fn plugin_auth_fetch( |
| 4687 | _state: State<Arc<ServerState>>, |
| 4688 | Path(name): Path<String>, |
| 4689 | Json(req): Json<PluginAuthFetchRequest>, |
| 4690 | ) -> Result<Json<PluginAuthFetchResponse>> { |
| 4691 | let bridge = get_auth_bridge(&name).await?; |
| 4692 | |
| 4693 | let fetch_req = opencode_plugin::subprocess::PluginFetchRequest { |
| 4694 | url: req.url, |
| 4695 | method: req.method, |
| 4696 | headers: req.headers, |
| 4697 | body: req.body, |
| 4698 | }; |
| 4699 | |
| 4700 | let result = bridge |
| 4701 | .fetch_proxy(fetch_req) |
| 4702 | .await |
| 4703 | .map_err(|e| ApiError::BadRequest(e.to_string()))?; |
| 4704 | |
| 4705 | Ok(Json(PluginAuthFetchResponse { |
| 4706 | status: result.status, |
| 4707 | headers: result.headers, |
| 4708 | body: result.body, |
| 4709 | })) |
| 4710 | } |
| 4711 | |
| 4712 | /// Helper: look up the auth bridge for a provider name. |
| 4713 | async fn get_auth_bridge(provider: &str) -> Result<Arc<PluginAuthBridge>> { |
nothing calls this directly
no test coverage detected