MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / fetch_proxy

Method fetch_proxy

crates/opencode-plugin/src/subprocess/auth.rs:148–173  ·  view source on GitHub ↗

Proxy an HTTP request through the plugin's custom fetch. Only valid when `has_custom_fetch()` is true (after a successful `load()`).

(
        &self,
        request: PluginFetchRequest,
    )

Source from the content-addressed store, hash-verified

146 ///
147 /// Only valid when `has_custom_fetch()` is true (after a successful `load()`).
148 pub async fn fetch_proxy(
149 &self,
150 request: PluginFetchRequest,
151 ) -> Result<PluginFetchResponse, PluginAuthError> {
152 if !self.has_custom_fetch() {
153 return Err(PluginAuthError::NoCustomFetch(
154 self.client.name().to_string(),
155 ));
156 }
157
158 let result = self
159 .client
160 .auth_fetch(
161 &request.url,
162 &request.method,
163 &request.headers,
164 request.body.as_deref(),
165 )
166 .await?;
167
168 Ok(PluginFetchResponse {
169 status: result.status,
170 headers: result.headers,
171 body: result.body,
172 })
173 }
174
175 /// Proxy an HTTP request through plugin custom fetch as a real-time stream.
176 pub async fn fetch_proxy_stream(

Callers 2

plugin_auth_fetchFunction · 0.80
fetchMethod · 0.80

Calls 3

has_custom_fetchMethod · 0.80
auth_fetchMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected