diff --git a/api_client/src/lib.rs b/api_client/src/lib.rs index f9c9ff409..8583def4e 100644 --- a/api_client/src/lib.rs +++ b/api_client/src/lib.rs @@ -131,7 +131,7 @@ fn parse_http_response(socket: &mut dyn Read) -> Result, Error> { } } } - let body_string = content_length.and(Some(String::from(&res[body_offset.unwrap()..]))); + let body_string = content_length.and(body_offset.map(|o| String::from(&res[o..]))); let status_code = get_status_code(&res)?; if status_code.is_server_error() {