Xuanwo commented on code in PR #5184:
URL: https://github.com/apache/opendal/pull/5184#discussion_r1802678373
##########
core/src/raw/http_util/client.rs:
##########
@@ -78,6 +81,34 @@ impl HttpClient {
/// Fetch a request in async way.
pub async fn fetch(&self, req: Request<Buffer>) ->
Result<Response<HttpBody>> {
+ self.fetcher.fetch(req).await
+ }
+}
+
+#[async_trait::async_trait]
+pub trait HttpFetch: Send + Sync {
+ /// Fetch a request in async way.
+ async fn fetch(&self, req: Request<Buffer>) -> Result<Response<HttpBody>>;
+}
+
+#[derive(Clone)]
+struct ReqwestHttpFetcher {
Review Comment:
We can do this in `opendal`. Users can implement via a wrapper.
##########
core/src/raw/http_util/client.rs:
##########
@@ -78,6 +81,34 @@ impl HttpClient {
/// Fetch a request in async way.
pub async fn fetch(&self, req: Request<Buffer>) ->
Result<Response<HttpBody>> {
+ self.fetcher.fetch(req).await
+ }
+}
+
+#[async_trait::async_trait]
+pub trait HttpFetch: Send + Sync {
+ /// Fetch a request in async way.
+ async fn fetch(&self, req: Request<Buffer>) -> Result<Response<HttpBody>>;
+}
+
+#[derive(Clone)]
+struct ReqwestHttpFetcher {
Review Comment:
We can do this in `opendal`. Users can implement via a wrapper outside.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]