mirror of
https://github.com/agersant/polaris
synced 2025-03-01 13:57:14 +00:00
Minor cleanup
This commit is contained in:
parent
259699a3e8
commit
00b4d4cb77
1 changed files with 5 additions and 5 deletions
|
@ -1,13 +1,13 @@
|
|||
use core::str::Utf8Error;
|
||||
use std::path::PathBuf;
|
||||
use std::ops::Deref;
|
||||
|
||||
use iron::prelude::*;
|
||||
use iron::status;
|
||||
use mount::Mount;
|
||||
use url::percent_encoding::percent_decode;
|
||||
|
||||
use collection::browse as collection_browse;
|
||||
use collection::flatten as collection_flatten;
|
||||
use collection;
|
||||
|
||||
pub fn get_api_handler() -> Mount {
|
||||
let mut mount = Mount::new();
|
||||
|
@ -19,7 +19,7 @@ pub fn get_api_handler() -> Mount {
|
|||
fn path_from_request(request: &Request) -> Result<PathBuf, Utf8Error> {
|
||||
let path_string = request.url.path().join("/");
|
||||
let decoded_path = percent_decode(path_string.as_bytes()).decode_utf8();
|
||||
decoded_path.map(|s| PathBuf::from(s.into_owned()))
|
||||
decoded_path.map(|s| PathBuf::from(s.deref()))
|
||||
}
|
||||
|
||||
fn browse(request: &mut Request) -> IronResult<Response> {
|
||||
|
@ -27,7 +27,7 @@ fn browse(request: &mut Request) -> IronResult<Response> {
|
|||
if path.is_err() {
|
||||
return Ok(Response::with((status::BadRequest)));
|
||||
}
|
||||
collection_browse(&path.unwrap());
|
||||
collection::browse(&path.unwrap());
|
||||
Ok(Response::with((status::Ok, "TODO browse data here")))
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,6 @@ fn flatten(request: &mut Request) -> IronResult<Response> {
|
|||
if path.is_err() {
|
||||
return Ok(Response::with((status::BadRequest)));
|
||||
}
|
||||
collection_flatten(&path.unwrap());
|
||||
collection::flatten(&path.unwrap());
|
||||
Ok(Response::with((status::Ok, "TODO Flatten data here")))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue