diff options
author | Ivan Tham <[email protected]> | 2018-08-08 03:27:42 +0100 |
---|---|---|
committer | Ivan Tham <[email protected]> | 2018-08-08 03:27:42 +0100 |
commit | a5c6f2afbe16d0328750f83db66b93b89111313b (patch) | |
tree | d1725268e6bcc747bd08b7ef39b33e8b8370fca5 | |
parent | d86da2ce6c687401fe8e6e34fc69cd22aaba72e1 (diff) |
Simplify response with json
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 85d25e7..a5c10e1 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -123,10 +123,7 @@ fn on_submit(s: &mut Cursive, name: &str) { | |||
123 | let mut link_vec: Vec<String> = vec![]; | 123 | let mut link_vec: Vec<String> = vec![]; |
124 | 124 | ||
125 | let mut res = reqwest::get(&url).unwrap(); | 125 | let mut res = reqwest::get(&url).unwrap(); |
126 | let v: Value = match serde_json::from_str(&res.text().unwrap()) { | 126 | let v: Value = res.json().expect("Failed to parse json"); |
127 | Ok(x) => x, | ||
128 | Err(x) => panic!("Failed to parse json\nReceived error {}", x), | ||
129 | }; | ||
130 | 127 | ||
131 | match get_extract(&v) { | 128 | match get_extract(&v) { |
132 | Ok(x) => extract = x, | 129 | Ok(x) => extract = x, |