From 21fe4418f2dd7bf72a20168ae17d30e216eb6214 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Sat, 16 Oct 2021 22:20:46 +0200 Subject: [PATCH] Added POST call for Session::init for demo purposes Signed-off-by: Louis Vallat --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6b2641c..5b0f996 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,21 @@ use hyper_tls::HttpsConnector; -use hyper::{Client, Uri}; +use hyper::{Body, Client, Method, Request}; use std::str; +use dotenv::dotenv; #[tokio::main] async fn main() -> Result<(), Box> { + dotenv().ok(); + let https = HttpsConnector::new(); let client = Client::builder().build::<_, hyper::Body>(https); + let req = Request::builder() + .method(Method::POST) + .uri(dotenv::var("LYCHEE_ENDPOINT").unwrap()) + .body(Body::empty()) + .expect("error"); + let res = client.request(req).await?; - let res = client.get(Uri::from_static("https://test.louis-vallat.xyz")).await?; println!("{}", res.status().as_u16()); let buf = hyper::body::to_bytes(res).await?;