pub fn oneshot_req_with_body(
        &self,
        endpoint: &str,
        method: &str,
        body: Option<String>,
    ) -> Result<String> {
        trace!("Body: {:#?}", body);
        let resp = if let Some(body) = body {
            self.build_request(endpoint, method)?.send_string(&body)?
        } else {
            self.build_request(endpoint, method)?.call()?
        };

        if resp.status() >= 400 {
            return Err(Error::FailedResponse(resp.status()));
        }

        let text = resp.into_string().map_err(|_| Error::BadResponseEncoding)?;
        trace!("Received response: {}", text);

        Ok(text)
    }
/// Send a oneshot request to the specific endpoint with method, with body
Send a oneshot request to the specific endpoint with method, with body
Send a oneshot request to the specific endpoint with method with body
pub fn oneshot_req_with_body(
        &self,
        endpoint: &str,
        method: &str,
        body: Option<String>,
    ) -> Result<String> {
        trace!("Body: {:#?}", body);
        let resp = if let Some(body) = body {
            self.build_request(endpoint, method)?.send_string(&body)?
        } else {
            self.build_request(endpoint, method)?.call()?
        };
        if resp.status() >= 400 {
            return Err(Error::FailedResponse(resp.status()));
        }
        let text = resp.into_string().map_err(|_| Error::BadResponseEncoding)?;
        trace!("Received response: {}", text);
        Ok(text)
    }
pub fn oneshot_req_with_body ( & self , endpoint : & str , method : & str , body : Option < String > , ) -> Result < String > { trace ! ( " " body ) ; let resp = if let Some ( body ) = body { self . build_request ( endpoint , method ) ? . send_string ( & body ) ? } else { self . build_request ( endpoint , method ) ? . call ( ) ? } ; if resp . status ( ) >= 400 { return Err ( Error :: FailedResponse ( resp . status ( ) ) ) ; } let text = resp . into_string ( ) . map_err ( | _ | Error :: BadResponseEncoding ) ? ; trace ! ( " " text ) ; Ok ( text ) }
Send a oneshot request to the specific endpoint with method, with body
Send a oneshot request to the specific endpoint with method with body
&self
endpoint
&str
method
&str
body
Option<String>
&self
endpoint
&str
method
&str
body
Option<String>