Refactor API handlers (#2572)

Also add some API tests
This commit is contained in:
hashmap
2019-02-15 22:17:00 +01:00
committed by GitHub
parent aad0e9402a
commit ac6ed71abd
10 changed files with 236 additions and 175 deletions
+9
View File
@@ -52,6 +52,15 @@ where
}
}
/// Helper function to easily issue a HTTP GET request
/// on a given URL that returns nothing. Handles request
/// building and response code checking.
pub fn get_no_ret(url: &str, api_secret: Option<String>) -> Result<(), Error> {
let req = build_request(url, "GET", api_secret, None)?;
send_request(req)?;
Ok(())
}
/// Helper function to easily issue a HTTP POST request with the provided JSON
/// object as body on a given URL that returns a JSON object. Handles request
/// building, JSON serialization and deserialization, and response code