pub fn with_json_body<S: Serialize>(mut self, body: &S) -> Result<Request<'a>> {
        let mut body_bytes: Vec<u8> = vec![];
        // Serialize json object to bytes
        serde_json::to_writer(&mut body_bytes, &body).map_err(|_| RequestError::InvalidJsonBody)?;

        self.body = Some(body_bytes);
        self.headers.append("Content-Type: application/json")?;
        Ok(self)
    }
/// Set the JSON request body for the request.
Set the JSON request body for the request.
Set the JSON request body for the request .
pub fn with_json_body<S: Serialize>(mut self, body: &S) -> Result<Request<'a>> {
        let mut body_bytes: Vec<u8> = vec![];
        // Serialize json object to bytes
        serde_json::to_writer(&mut body_bytes, &body).map_err(|_| RequestError::InvalidJsonBody)?;
        self.body = Some(body_bytes);
        self.headers.append("Content-Type: application/json")?;
        Ok(self)
    }
pub fn with_json_body < S : Serialize > ( mut self , body : & S ) -> Result < Request < ' a > > { let mut body_bytes : Vec < u8 > = vec ! [ ] ; // Serialize json object to bytes serde_json :: to_writer ( & mut body_bytes , & body ) . map_err ( | _ | RequestError :: InvalidJsonBody ) ? ; self . body = Some ( body_bytes ) ; self . headers . append ( " " ) ? ; Ok ( self ) }
Set the JSON request body for the request.
Set the JSON request body for the request .
mut self
body
&S
mut self
body
&S