blob: 3d11a8b0f62283a79a097897615c255fa5fcc2bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
use actix_web::{HttpRequest, Json, Result, Responder};
use std::ops::Deref;
pub mod messages;
use messages::*;
pub fn not_understood(_req: &HttpRequest) -> impl Responder {
"Hello, world!"
}
pub fn callback(req: &HttpRequest) -> Result<Json<Callback>> {
let path = String::from(req.path());
let request = (*(req.query().deref())).clone();
Ok(Json(Callback {
path: destruct_path(path),
request: request,
}))
}
fn destruct_path(path: String) -> Vec<String> {
path.split_terminator("/")
.skip(1)
.map(|s| String::from(s))
.collect::<Vec<String>>()
}
|