get_optional parse Option to allow 'null' body

pull/16/head
Mingwei Samuel 2020-06-05 11:14:43 -07:00
parent 14e6faa24e
commit b15672baaa
1 changed files with 2 additions and 3 deletions

View File

@ -89,9 +89,8 @@ impl RiotApi {
}
let retries = rinfo.retries;
let status = rinfo.response.status();
let value = rinfo.response.json::<T>().await;
value.map(|v| Some(v))
.map_err(|e| RiotApiError::new(e, retries, None, Some(status)))
let value = rinfo.response.json::<Option<T>>().await;
value.map_err(|e| RiotApiError::new(e, retries, None, Some(status)))
}
/// This method is not meant to be used directly.