mount an atproto PDS repository as a FUSE filesystem
at main 883 B view raw
1use atrium_xrpc::HttpClient; 2 3pub struct DefaultHttpClient { 4 client: reqwest::Client, 5} 6 7impl HttpClient for DefaultHttpClient { 8 async fn send_http( 9 &self, 10 request: atrium_xrpc::http::Request<Vec<u8>>, 11 ) -> core::result::Result< 12 atrium_xrpc::http::Response<Vec<u8>>, 13 Box<dyn std::error::Error + Send + Sync + 'static>, 14 > { 15 let response = self.client.execute(request.try_into()?).await?; 16 let mut builder = atrium_xrpc::http::Response::builder().status(response.status()); 17 for (k, v) in response.headers() { 18 builder = builder.header(k, v); 19 } 20 builder 21 .body(response.bytes().await?.to_vec()) 22 .map_err(Into::into) 23 } 24} 25 26impl Default for DefaultHttpClient { 27 fn default() -> Self { 28 Self { 29 client: reqwest::Client::new(), 30 } 31 } 32}