src/client/http_client.rs: code cleanup
This commit is contained in:
		@ -330,18 +330,11 @@ impl HttpClient {
 | 
			
		||||
        Box::new(login_future)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn api_request(
 | 
			
		||||
        client: Client<hyper_tls::HttpsConnector<hyper::client::HttpConnector>>,
 | 
			
		||||
        req: Request<Body>
 | 
			
		||||
    ) -> impl Future<Item=Value, Error=Error> {
 | 
			
		||||
    fn api_response(response: Response<Body>) -> impl Future<Item=Value, Error=Error> {
 | 
			
		||||
 | 
			
		||||
        client.request(req)
 | 
			
		||||
            .map_err(Error::from)
 | 
			
		||||
            .and_then(|resp| {
 | 
			
		||||
        let status = response.status();
 | 
			
		||||
 | 
			
		||||
                let status = resp.status();
 | 
			
		||||
 | 
			
		||||
                resp
 | 
			
		||||
        response
 | 
			
		||||
            .into_body()
 | 
			
		||||
            .concat2()
 | 
			
		||||
            .map_err(Error::from)
 | 
			
		||||
@ -359,7 +352,16 @@ impl HttpClient {
 | 
			
		||||
                    bail!("HTTP Error {}: {}", status, text);
 | 
			
		||||
                }
 | 
			
		||||
            })
 | 
			
		||||
            })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn api_request(
 | 
			
		||||
        client: Client<hyper_tls::HttpsConnector<hyper::client::HttpConnector>>,
 | 
			
		||||
        req: Request<Body>
 | 
			
		||||
    ) -> impl Future<Item=Value, Error=Error> {
 | 
			
		||||
 | 
			
		||||
        client.request(req)
 | 
			
		||||
            .map_err(Error::from)
 | 
			
		||||
            .and_then(Self::api_response)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn request_builder(server: &str, method: &str, path: &str, data: Option<Value>) -> Result<Request<Body>, Error> {
 | 
			
		||||
@ -550,7 +552,7 @@ impl BackupClient {
 | 
			
		||||
 | 
			
		||||
                //upload_pxar(h2, known_chunks, &dir_path, wid).unwrap()
 | 
			
		||||
                Self::upload_stream(h2_3, wid, stream, known_chunks.clone())
 | 
			
		||||
                    .and_then(move |size| {
 | 
			
		||||
                    .and_then(move |_size| {
 | 
			
		||||
                        Self::h2post(h2_4, "dynamic_close", Some(json!({ "wid": wid })))
 | 
			
		||||
                    })
 | 
			
		||||
                    .map(|_| ())
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user