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

Method fetch_stream

crates/opencode-server/src/server.rs:61–83  ·  view source on GitHub ↗
(
        &self,
        request: CustomFetchRequest,
    )

Source from the content-addressed store, hash-verified

59 }
60
61 async fn fetch_stream(
62 &self,
63 request: CustomFetchRequest,
64 ) -> Result<CustomFetchStreamResponse, ProviderError> {
65 let response = self
66 .bridge
67 .fetch_proxy_stream(PluginFetchRequest {
68 url: request.url,
69 method: request.method,
70 headers: request.headers,
71 body: request.body,
72 })
73 .await
74 .map_err(|e| ProviderError::NetworkError(e.to_string()))?;
75
76 let stream = ReceiverStream::new(response.chunks)
77 .map(|item| item.map_err(|e| ProviderError::NetworkError(e.to_string())));
78 Ok(CustomFetchStreamResponse {
79 status: response.status,
80 headers: response.headers,
81 stream: Box::pin(stream),
82 })
83 }
84}
85
86pub(crate) fn sync_custom_fetch_proxy(

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
fetch_proxy_streamMethod · 0.80

Tested by

no test coverage detected