aboutsummaryrefslogtreecommitdiff
path: root/src/k2v-client
diff options
context:
space:
mode:
Diffstat (limited to 'src/k2v-client')
-rw-r--r--src/k2v-client/lib.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/k2v-client/lib.rs b/src/k2v-client/lib.rs
index 4977ce85..f70442f4 100644
--- a/src/k2v-client/lib.rs
+++ b/src/k2v-client/lib.rs
@@ -9,7 +9,7 @@ use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
use http::header::{ACCEPT, CONTENT_TYPE};
use http::status::StatusCode;
use http::{HeaderName, HeaderValue, Request};
-use hyper::{body::Bytes, Body};
+use hyper::{body::Bytes, body::HttpBody, Body};
use hyper::{client::connect::HttpConnector, Client as HttpClient};
use hyper_rustls::HttpsConnector;
@@ -416,12 +416,16 @@ impl K2vClient {
};
let body = match res.status {
- StatusCode::OK => hyper::body::to_bytes(body).await?,
+ StatusCode::OK => body.collect().await?.to_bytes(),
StatusCode::NO_CONTENT => Bytes::new(),
StatusCode::NOT_FOUND => return Err(Error::NotFound),
StatusCode::NOT_MODIFIED => Bytes::new(),
s => {
- let err_body = hyper::body::to_bytes(body).await.unwrap_or_default();
+ let err_body = body
+ .collect()
+ .await
+ .map(|x| x.to_bytes())
+ .unwrap_or_default();
let err_body_str = std::str::from_utf8(&err_body)
.map(String::from)
.unwrap_or_else(|_| BASE64_STANDARD.encode(&err_body));