Skip to content

Commit

Permalink
Replace deprecatated hyper::body::to_bytes usage
Browse files Browse the repository at this point in the history
The hyper::body::to_bytes function has been deprecated in favor of a
different construct. Switch over.
  • Loading branch information
d-e-s-o committed Jun 22, 2024
1 parent 3da183b commit 5ed312a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ _num_bigint_unused = { package = "num-bigint", version = "0.4.2" }
_proc_macro2_unused = { package = "proc-macro2", version = "1.0.60" }
# error: pasting "RUST_VERSION_OPENSSL_" and "(" does not give a valid preprocessing token
_openssl_unused = {package = "openssl", version = "0.10.35"}
# error[E0599]: `Body` is not an iterator
_http_body_unused = {package = "http-body", version = "0.4.6"}
6 changes: 3 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2023 The apca Developers
// Copyright (C) 2019-2024 The apca Developers
// SPDX-License-Identifier: GPL-3.0-or-later

use std::borrow::Cow;
Expand All @@ -15,8 +15,8 @@ use http::Request;
use http::Response;
use http_endpoint::Endpoint;

use hyper::body::to_bytes;
use hyper::body::Bytes;
use hyper::body::HttpBody as _;
use hyper::client::Builder as HttpClientBuilder;
use hyper::client::HttpConnector;
use hyper::Body;
Expand Down Expand Up @@ -219,7 +219,7 @@ impl Client {
// to cause trouble: when we receive, for example, the
// list of all orders it now needs to be stored in memory
// in its entirety. That may blow things.
to_bytes(response).await
Ok(response.collect().await?.to_bytes())
}

/// Retrieve the HTTP body, possible uncompressing it if it was gzip
Expand Down

0 comments on commit 5ed312a

Please sign in to comment.