From ef3a5a6ee6d878503a0c781db676592e3c4f54fa Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 14 Apr 2018 18:30:56 +0200 Subject: find_upcoming_events(): Try to parse data from the Meetup API * Clone the token so we can use it without a borrow error * Get the response text from our request to the API and try to parse it This gives me the following panic: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorImpl { code: Message("invalid type: null, expected a sequence"), line: 0, column: 0 }', libcore/result.rs:945:5 Still trying to figure out where my problem is. --- meetup/src/client.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'meetup') diff --git a/meetup/src/client.rs b/meetup/src/client.rs index f47c439..6f98a1f 100644 --- a/meetup/src/client.rs +++ b/meetup/src/client.rs @@ -24,9 +24,8 @@ impl Client { radius: Option, page: Option, ) -> Result, Box> { - let json = include_str!("../testdata/meetup--find-upcoming_events.json").to_owned(); - let mut params = vec![ + ("key", self.token.clone()), ("lat", latitude), ("lon", longitude), ("end_date_range", end_date_range), @@ -42,11 +41,13 @@ impl Client { } let client = reqwest::Client::new(); - client.get(&format!("{}{}", MEETUP_BASE_URL, "/find/upcoming_events")) + let response_text = client + .get(&format!("{}{}", MEETUP_BASE_URL, "/find/upcoming_events")) .query(¶ms) - .send()?; + .send()? + .text()?; - Ok(parse_json(json)?) + Ok(parse_json(response_text)?) } } -- cgit v1.2.3