platform: support unix

This commit is contained in:
Tunglies 2025-04-16 00:41:40 +08:00
parent 670333fcc2
commit 7b352a44f1

View File

@ -1,4 +1,3 @@
// #[cfg(any(target_os = "linux", target_os = "macos"))]
use crate::model::E; use crate::model::E;
use http_body_util::{BodyExt, Full}; use http_body_util::{BodyExt, Full};
use hyper::{ use hyper::{
@ -30,12 +29,12 @@ impl UnixClient {
pub async fn send_request( pub async fn send_request(
&self, &self,
socket_path: &str, socket_path: String,
path: &str, path: &str,
method: Method, method: Method,
body: Option<Value>, body: Option<Value>,
) -> Result<Value, E> { ) -> Result<Value, E> {
let uri = self.generate_unix_path(socket_path, path).await; let uri = self.generate_unix_path(socket_path.as_str(), path).await;
let mut request_builder = Request::builder().method(method).uri(uri); let mut request_builder = Request::builder().method(method).uri(uri);
@ -57,4 +56,4 @@ impl UnixClient {
Ok(json_value) Ok(json_value)
} }
} }