mirror of
https://github.com/MingweiSamuel/Riven.git
synced 2024-12-27 03:16:33 +00:00
Let Reqwest text()
convert the Response to a String
This commit is contained in:
parent
169fa50f63
commit
60317be114
1 changed files with 4 additions and 7 deletions
|
@ -113,15 +113,12 @@ impl RegionalRequester {
|
||||||
{
|
{
|
||||||
log::debug!("Response {} (retried {} times), returning.", status, retries);
|
log::debug!("Response {} (retried {} times), returning.", status, retries);
|
||||||
|
|
||||||
// Extract the response body from bytes into a String,
|
// Extract the response body as a String
|
||||||
// accounting for potentially non-utf-8 characters.
|
let content = response.text().await;
|
||||||
let content = response.bytes().await;
|
|
||||||
|
|
||||||
break match content {
|
break match content {
|
||||||
Ok(bytes) => {
|
Ok(str) => {
|
||||||
let body = String::from_utf8_lossy(&bytes).into_owned();
|
Err(RiotApiError::new(err, retries, Some(headers), Some(status), Some(str)))
|
||||||
|
|
||||||
Err(RiotApiError::new(err, retries, Some(headers), Some(status), Some(body)))
|
|
||||||
}
|
}
|
||||||
Err(_inner_err) => {
|
Err(_inner_err) => {
|
||||||
// Throw the inner error away and ignore response body parsing
|
// Throw the inner error away and ignore response body parsing
|
||||||
|
|
Loading…
Reference in a new issue