pub async fn read(self) -> crate::Result<ResponseData> {
    let url = self.1.url().to_string();
    let mut headers = HashMap::new();
    for (name, value) in self.1.headers() {
      headers.insert(name.as_str().to_string(), value.to_str()?.to_string());
    }
    let status = self.1.status().as_u16();

    let data = match self.0 {
      ResponseType::Json => self.1.json().await?,
      ResponseType::Text => Value::String(self.1.text().await?),
      ResponseType::Binary => Value::String(serde_json::to_string(&self.1.bytes().await?)?),
    };

    Ok(ResponseData {
      url,
      status,
      headers,
      data,
    })
  }
/// Reads the response and returns its info.
Reads the response and returns its info.
Reads the response and returns its info .
pub async fn read(self) -> crate::Result<ResponseData> {
    let url = self.1.url().to_string();
    let mut headers = HashMap::new();
    for (name, value) in self.1.headers() {
      headers.insert(name.as_str().to_string(), value.to_str()?.to_string());
    }
    let status = self.1.status().as_u16();
    let data = match self.0 {
      ResponseType::Json => self.1.json().await?,
      ResponseType::Text => Value::String(self.1.text().await?),
      ResponseType::Binary => Value::String(serde_json::to_string(&self.1.bytes().await?)?),
    };
    Ok(ResponseData {
      url,
      status,
      headers,
      data,
    })
  }
pub async fn read ( self ) -> crate :: Result < ResponseData > { let url = self . 1 . url ( ) . to_string ( ) ; let mut headers = HashMap :: new ( ) ; for ( name , value ) in self . 1 . headers ( ) { headers . insert ( name . as_str ( ) . to_string ( ) , value . to_str ( ) ? . to_string ( ) ) ; } let status = self . 1 . status ( ) . as_u16 ( ) ; let data = match self . 0 { ResponseType :: Json => self . 1 . json ( ) . await ? , ResponseType :: Text => Value :: String ( self . 1 . text ( ) . await ? ) , ResponseType :: Binary => Value :: String ( serde_json :: to_string ( & self . 1 . bytes ( ) . await ? ) ? ) , } ; Ok ( ResponseData { url , status , headers , data , } ) }
Reads the response and returns its info.
Reads the response and returns its info .
self
self