fix: extract html responses

This commit is contained in:
əlemi 2024-10-19 22:02:18 +02:00
parent 23abb7706e
commit 6fa7606226
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -186,7 +186,7 @@ async fn format_body(res: reqwest::Response) -> Result<String, PostWomanError> {
None => Ok(res.text().await? + "\n"),
Some(v) => match v.to_str()? {
"application/json" => Ok(serde_json::to_string_pretty(&res.json::<serde_json::Value>().await?)? + "\n"),
"text/plain" => Ok(res.text().await? + "\n"),
"text/plain" | "text/html" => Ok(res.text().await? + "\n"),
_ => Ok(format!("base64({})\n", BASE64_STANDARD.encode(res.bytes().await?))),
},
}