aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/messages.rs2
-rw-r--r--src/routes/mod.rs10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/routes/messages.rs b/src/routes/messages.rs
index 694a2a2..c4d7b5c 100644
--- a/src/routes/messages.rs
+++ b/src/routes/messages.rs
@@ -14,6 +14,6 @@ pub struct Callback {
impl Message for Callback {
fn name(&self) -> String {
- String::from("Callback")
+ String::from("CALLBACK")
}
} \ No newline at end of file
diff --git a/src/routes/mod.rs b/src/routes/mod.rs
index 3d11a8b..ca70dcf 100644
--- a/src/routes/mod.rs
+++ b/src/routes/mod.rs
@@ -9,8 +9,9 @@ pub fn not_understood(_req: &HttpRequest) -> impl Responder {
}
pub fn callback(req: &HttpRequest) -> Result<Json<Callback>> {
- let path = String::from(req.path());
- let request = (*(req.query().deref())).clone();
+ let path = req.path();
+ let query_ref = req.query();
+ let request = query_ref.deref().clone();
Ok(Json(Callback {
path: destruct_path(path),
@@ -18,9 +19,10 @@ pub fn callback(req: &HttpRequest) -> Result<Json<Callback>> {
}))
}
-fn destruct_path(path: String) -> Vec<String> {
+fn destruct_path(path: &str) -> Vec<String> {
path.split_terminator("/")
+ // first element is always blank due to link starting with "/api"
.skip(1)
- .map(|s| String::from(s))
+ .map(String::from)
.collect::<Vec<String>>()
} \ No newline at end of file