Fix /joke

This commit is contained in:
TheKodeToad 2024-04-30 22:23:07 +01:00 committed by Sefa Eyeoglu
parent ba70c61bc4
commit a4197bc5af

View file

@ -5,7 +5,13 @@ use eyre::Result;
const DADJOKE: &str = "https://icanhazdadjoke.com"; const DADJOKE: &str = "https://icanhazdadjoke.com";
pub async fn get_joke(http: &HttpClient) -> Result<String> { pub async fn get_joke(http: &HttpClient) -> Result<String> {
let joke = http.get_request(DADJOKE).await?.text().await?; let joke = http
.get(DADJOKE)
.header("Accept", "text/plain")
.send()
.await?
.text()
.await?;
Ok(joke) Ok(joke)
} }