This repository has been archived by the owner on Sep 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Update all hyper/http/http-body instances to >1 #790
Labels
Comments
jsantell
added
Chore
Non-user-facing feature
dependencies
Pull requests that update a dependency file
labels
Jan 22, 2024
Attempting to update -hyper = { version = "^0.14.27", features = ["full"] }
+bytes = { workspace = true }
+http-body-util = { workspace = true }
+hyper = { version = "^1.1.0", features = ["full"] }
+hyper-util = { version = "0.1.3", features = ["client", "client-legacy", "http1"] } -use hyper::{
- client::connect::dns::GaiResolver, client::HttpConnector, Body, Client, Request, StatusCode,
-};
+use http_body_util::{BodyExt, Empty, Full};
+use hyper::{Request, StatusCode};
use hyper_multipart_rfc7578::client::multipart::{Body as MultipartBody, Form};
+use hyper_util::{
+ client::legacy::{
+ connect::{dns::GaiResolver, HttpConnector},
+ Client,
+ },
+ rt::TokioExecutor,
+};
use tokio_util::compat::TokioAsyncReadCompatExt;
// TODO(#587): Remove dependency on `ipfs-api` crate
use ipfs_api_prelude::response::{PinAddResponse, PinLsResponse};
@@ -43,14 +49,14 @@ const KUBO_DAG_IMPORT_TIMEOUT: Duration = Duration::from_secs(60);
/// their expected payloads to Noosphere-friendly formats
#[derive(Clone, Debug)]
pub struct KuboClient {
- client: Client<HttpConnector<GaiResolver>>,
+ client: Client<HttpConnector<GaiResolver>, Empty<Bytes>>,
api_url: Url,
}
impl KuboClient {
// TODO: This probably doesn't need to return a result
pub fn new(api_url: &Url) -> Result<Self> {
- let client = hyper::Client::builder().build_http();
+ let client = Client::builder(TokioExecutor::new()).build_http();
Ok(KuboClient {
client,
api_url: api_url.clone(),
@@ -76,10 +82,10 @@ impl IpfsClient for KuboClient {
let request = Request::builder()
.method("POST")
.uri(&api_url.to_string())
- .body(Body::empty())?;
+ .body(Empty::new())?;
let response = self.client.request(request).await?;
- let body_bytes = hyper::body::to_bytes(response.into_body()).await?;
+ let body_bytes = response.into_body().collect().await?.to_bytes(); TBD between |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
With
axum
updated to >0.7 (#778), we're using the lower level componentshttp
,hyper
,http-body
at their 1.0+ releases. In tree, we're still using[email protected]
and olderhttp
/http-body
deps. Focusing onhyper
here, buthttp
andhttp-body
deps should also be >1.0.hyper-rustls
will need to be updated as well, but I believe should be a part of this changehyper-multipart-rfc7578
and its dependentcommon-multipart-rfc7578
, pinned on older hyper & friends.ipfs-api-prelude
, which uses thecommon-multipart-rfc7578
fromhyper-multipart-rfc7578
Remove dependency onipfs-api
Rust crate #587gloo-net
could be updated to use >1.0 ofhttp
(currently on[email protected]
)The text was updated successfully, but these errors were encountered: