pub fn json<J: serde::Serialize>(self, body: &J) -> serde_json::Result<Request> {
        let mut buffer = utils::BytesWriter::new();
        let _ = serde_json::to_writer(&mut buffer, &body)?;
        let body = buffer.into_inner().freeze();
        Ok(self.set_header_if_none(header::CONTENT_TYPE, "application/json").body(Some(body)))
    }
///Creates request with JSON payload.
Creates request with JSON payload.
Creates request with JSON payload .
pub fn json<J: serde::Serialize>(self, body: &J) -> serde_json::Result<Request> {
        let mut buffer = utils::BytesWriter::new();
        let _ = serde_json::to_writer(&mut buffer, &body)?;
        let body = buffer.into_inner().freeze();
        Ok(self.set_header_if_none(header::CONTENT_TYPE, "application/json").body(Some(body)))
    }
pub fn json < J : serde :: Serialize > ( self , body : & J ) -> serde_json :: Result < Request > { let mut buffer = utils :: BytesWriter :: new ( ) ; let _ = serde_json :: to_writer ( & mut buffer , & body ) ? ; let body = buffer . into_inner ( ) . freeze ( ) ; Ok ( self . set_header_if_none ( header :: CONTENT_TYPE , " " ) . body ( Some ( body ) ) ) }
Creates request with JSON payload.
Creates request with JSON payload .
self
body
&J