From 8b62f47ac3f5de43fbbe0445d0958eb8710f9174 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Fri, 15 Feb 2019 08:49:14 +0000 Subject: [PATCH] async/request: return a impl Future on send() --- src/async_impl/request.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/async_impl/request.rs b/src/async_impl/request.rs index 9b63913..c844a34 100644 --- a/src/async_impl/request.rs +++ b/src/async_impl/request.rs @@ -1,13 +1,15 @@ use std::fmt; use base64::{encode}; +use futures::Future; use serde::Serialize; use serde_json; use serde_urlencoded; use super::body::{Body}; -use super::multipart; use super::client::{Client, Pending}; +use super::multipart; +use super::response::Response; use header::{CONTENT_LENGTH, CONTENT_TYPE, HeaderMap, HeaderName, HeaderValue}; use http::HttpTryFrom; use {Method, Url}; @@ -315,13 +317,14 @@ impl RequestBuilder { self.request } - /// Constructs the Request and sends it the target URL, returning a Response. + /// Constructs the Request and sends it to the target URL, returning a + /// future Response. /// /// # Errors /// /// This method fails if there was an error while sending request, /// redirect loop was detected or redirect limit was exhausted. - pub fn send(self) -> Pending { + pub fn send(self) -> impl Future { match self.request { Ok(req) => self.client.execute(req), Err(err) => Pending::new_err(err),