Added POST call for Session::init for demo purposes
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
0907126f09
commit
21fe4418f2
12
src/main.rs
12
src/main.rs
@ -1,13 +1,21 @@
|
|||||||
use hyper_tls::HttpsConnector;
|
use hyper_tls::HttpsConnector;
|
||||||
use hyper::{Client, Uri};
|
use hyper::{Body, Client, Method, Request};
|
||||||
use std::str;
|
use std::str;
|
||||||
|
use dotenv::dotenv;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
|
dotenv().ok();
|
||||||
|
|
||||||
let https = HttpsConnector::new();
|
let https = HttpsConnector::new();
|
||||||
let client = Client::builder().build::<_, hyper::Body>(https);
|
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());
|
println!("{}", res.status().as_u16());
|
||||||
|
|
||||||
let buf = hyper::body::to_bytes(res).await?;
|
let buf = hyper::body::to_bytes(res).await?;
|
||||||
|
Loading…
Reference in New Issue
Block a user