Hi,
I am trying to use this hyperlocal to send http api to my http server in below method:
pub async fn put(&self, path: &str, data: Option<String>) -> Result<()> {
let client = Client::unix();
let uri = Uri::new(&self.sock_path, path);
let (body, _) = if let Some(d) = data {
let l = d.len();
(d.into(), l)
} else {
(Body::empty(), 0)
};
let req = Request::builder()
.method(Method::PUT)
.uri(uri)
.body(body)
.unwrap();
client.request(req).await.unwrap();
But my http user gets no body from the request.
Do we have examples on how to PUT/POST http request with body? Or did I do something wrong in above code snippet?
Hi, I am trying to use this
hyperlocal
to send http api to my http server in below method:But my http user gets no body from the request. Do we have examples on how to PUT/POST http request with body? Or did I do something wrong in above code snippet?