-
-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: clux <[email protected]>
- Loading branch information
Showing
4 changed files
with
21 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,9 @@ | |
use either::{Either, Left, Right}; | ||
use futures::{self, AsyncBufRead, StreamExt, TryStream, TryStreamExt}; | ||
Check warning on line 11 in kube-client/src/client/mod.rs GitHub Actions / clippyunused import: `TryStreamExt`
Check warning on line 11 in kube-client/src/client/mod.rs GitHub Actions / clippyunused import: `StreamExt`
|
||
use http::{self, Request, Response, StatusCode}; | ||
use hyper::Body; | ||
use http_body::Body; | ||
use http_body_util::BodyStream; | ||
use hyper::body::Incoming; | ||
use k8s_openapi::apimachinery::pkg::apis::meta::v1 as k8s_meta_v1; | ||
pub use kube_core::response::Status; | ||
use serde::de::DeserializeOwned; | ||
|
@@ -65,7 +67,7 @@ pub use builder::{ClientBuilder, DynBody}; | |
pub struct Client { | ||
// - `Buffer` for cheap clone | ||
// - `BoxService` for dynamic response future type | ||
inner: Buffer<BoxService<Request<Body>, Response<Body>, BoxError>, Request<Body>>, | ||
inner: Buffer<BoxService<Request<Incoming>, Response<Incoming>, BoxError>, Request<Incoming>>, | ||
default_ns: String, | ||
} | ||
|
||
|
@@ -99,15 +101,15 @@ impl Client { | |
/// ``` | ||
pub fn new<S, B, T>(service: S, default_namespace: T) -> Self | ||
where | ||
S: Service<Request<Body>, Response = Response<B>> + Send + 'static, | ||
S: Service<Request<Incoming>, Response = Response<B>> + Send + 'static, | ||
S::Future: Send + 'static, | ||
S::Error: Into<BoxError>, | ||
B: http_body::Body<Data = bytes::Bytes> + Send + 'static, | ||
B::Error: Into<BoxError>, | ||
T: Into<String>, | ||
{ | ||
// Transform response body to `hyper::Body` and use type erased error to avoid type parameters. | ||
let service = MapResponseBodyLayer::new(|b: B| Body::wrap_stream(b.into_stream())) | ||
let service = MapResponseBodyLayer::new(|b: B| BodyStream::new(b.into_stream())) | ||
.layer(service) | ||
.map_err(|e| e.into()); | ||
Check failure on line 114 in kube-client/src/client/mod.rs GitHub Actions / clippythe method `map_err` exists for struct `MapResponseBody<S, {[email protected]:112:49}>`, but its trait bounds were not satisfied
|
||
Self { | ||
|
@@ -141,7 +143,7 @@ impl Client { | |
/// Perform a raw HTTP request against the API and return the raw response back. | ||
/// This method can be used to get raw access to the API which may be used to, for example, | ||
/// create a proxy server or application-level gateway between localhost and the API server. | ||
pub async fn send(&self, request: Request<Body>) -> Result<Response<Body>> { | ||
pub async fn send(&self, request: Request<Incoming>) -> Result<Response<Incoming>> { | ||
let mut svc = self.inner.clone(); | ||
let res = svc | ||
.ready() | ||
|