1use wstd::http::Client;
2use wstd::io::empty;
3
4pub use http::{Request, Uri};
5
6pub async fn fetch<B: wstd::http::Body>(request: Request<B>) -> Result<Vec<u8>, wstd::http::Error> {
7 let client = Client::new();
8 let response = client.send(request).await?;
9 return response.into_body().bytes().await;
10}
11
12pub async fn get(uri: impl Into<http::Uri>) -> Result<Vec<u8>, wstd::http::Error> {
13 return fetch(
14 Request::builder()
15 .uri(uri.into())
16 .body(empty())
17 .expect("static"),
18 )
19 .await;
20}