From 565bed2b9d8dfafe4bb5fd2d371a144b25294b2f Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Tue, 5 Jun 2018 23:43:10 -0700 Subject: [PATCH] Change /read to use a list of IDs instead of POSTing JSON --- server/src/web.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/server/src/web.rs b/server/src/web.rs index 6ec6c572..66aa5efa 100644 --- a/server/src/web.rs +++ b/server/src/web.rs @@ -10,7 +10,6 @@ use project::Project; use rbx::RbxInstance; use rbx_session::RbxSession; use session::Session; -use web_util::read_json; /// The set of configuration the web server needs to start. pub struct WebConfig { @@ -168,10 +167,15 @@ impl Server { }) }, - (POST) (/api/read) => { - let requested_ids = match read_json::>(request) { - Some(body) => body, - None => return rouille::Response::text("Malformed JSON").with_status_code(400), + (GET) (/api/read/{ id_list: String }) => { + let requested_ids = id_list + .split(",") + .map(str::parse::) + .collect::, _>>(); + + let requested_ids = match requested_ids { + Ok(v) => v, + Err(_) => return rouille::Response::text("Malformed ID list").with_status_code(400), }; let rbx_session = self.config.rbx_session.read().unwrap();