MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / plugin_auth_fetch

Function plugin_auth_fetch

crates/opencode-server/src/routes.rs:4686–4710  ·  view source on GitHub ↗
(
    _state: State<Arc<ServerState>>,
    Path(name): Path<String>,
    Json(req): Json<PluginAuthFetchRequest>,
)

Source from the content-addressed store, hash-verified

4684}
4685
4686async 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.
4713async fn get_auth_bridge(provider: &str) -> Result<Arc<PluginAuthBridge>> {

Callers

nothing calls this directly

Calls 2

get_auth_bridgeFunction · 0.85
fetch_proxyMethod · 0.80

Tested by

no test coverage detected