From b15672baaaf61f0496d8903d834cc86051753254 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Fri, 5 Jun 2020 11:14:43 -0700 Subject: [PATCH] get_optional parse Option to allow 'null' body --- src/riot_api.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/riot_api.rs b/src/riot_api.rs index 7149278..5a9b0a3 100644 --- a/src/riot_api.rs +++ b/src/riot_api.rs @@ -89,9 +89,8 @@ impl RiotApi { } let retries = rinfo.retries; let status = rinfo.response.status(); - let value = rinfo.response.json::().await; - value.map(|v| Some(v)) - .map_err(|e| RiotApiError::new(e, retries, None, Some(status))) + let value = rinfo.response.json::>().await; + value.map_err(|e| RiotApiError::new(e, retries, None, Some(status))) } /// This method is not meant to be used directly.