fn request<T>(&self, client: &HyperClient, method: Method,
                  rel_url: &str, data: Option<T>)
                 -> BerylliumFuture<(StatusCode, Headers, Body)>
        where T: Serialize
    {
        let mut request = self.prepare_request_for_url(method, rel_url);
        request.headers_mut().set(ContentType::json());

        if let Some(object) = data {
            let res = serde_json::to_vec(&object).map(|bytes| {   // FIXME: Error?
                debug!("Setting JSON payload");
                request.set_body::<Vec<u8>>(bytes.into());
            });

            future_try!(res);
        }

        HttpsClient::request_with_request(client, request)
    }
/// Generic request builder for all API requests.
Generic request builder for all API requests.
Generic request builder for all API requests .
fn request<T>(&self, client: &HyperClient, method: Method,
                  rel_url: &str, data: Option<T>)
                 -> BerylliumFuture<(StatusCode, Headers, Body)>
        where T: Serialize
    {
        let mut request = self.prepare_request_for_url(method, rel_url);
        request.headers_mut().set(ContentType::json());
        if let Some(object) = data {
            let res = serde_json::to_vec(&object).map(|bytes| {   // FIXME: Error?
                debug!("Setting JSON payload");
                request.set_body::<Vec<u8>>(bytes.into());
            });
            future_try!(res);
        }
        HttpsClient::request_with_request(client, request)
    }
fn request < T > ( & self , client : & HyperClient , method : Method , rel_url : & str , data : Option < T > ) -> BerylliumFuture < ( StatusCode , Headers , Body ) > where T : Serialize { let mut request = self . prepare_request_for_url ( method , rel_url ) ; request . headers_mut ( ) . set ( ContentType :: json ( ) ) ; if let Some ( object ) = data { let res = serde_json :: to_vec ( & object ) . map ( | bytes | { // FIXME: Error? debug ! ( " " ) ; request . set_body :: < Vec < u8 > > ( bytes . into ( ) ) ; } ) ; future_try ! ( res ) ; } HttpsClient :: request_with_request ( client , request ) }
Generic request builder for all API requests.
Generic request builder for all API requests .
&self
client
&HyperClient
method
Method
rel_url
&str
data
Option<T>