tabs before some messages for clearer reasoning on what happen on each request
This commit is contained in:
parent
7ea3aef1cb
commit
362eb53650
@ -37,7 +37,7 @@ pub async fn wall_entry(path: &str, pool: &Pool, params: &serde_json::Value) ->
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Issue fetching auth data {:?}", e);
|
||||
println!("\tIssue fetching auth data {:?}", e);
|
||||
Ok(AuthReason::NoKey)
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ mod db_types;
|
||||
async fn route_dispatcher(pool: &Pool, resp: &mut Response<Body>, meth: &Method, path: &str, params: serde_json::Value) {
|
||||
// At some point we should have some way of hiding this obnoxious complexity
|
||||
use routes::resolve_dynamic_route;
|
||||
println!("{}: {}", meth, path);
|
||||
match (meth, path) {
|
||||
(&Method::GET, routes::INVITE_JOIN) => {
|
||||
if let Err(_) = invites::route_join_invite_code(pool, resp, params).await {
|
||||
@ -60,11 +59,11 @@ async fn route_dispatcher(pool: &Pool, resp: &mut Response<Body>, meth: &Method,
|
||||
// we're not doing any heavy calculations at any point
|
||||
if let Some(route) = resolve_dynamic_route(path) {
|
||||
*resp.status_mut() = StatusCode::OK;
|
||||
println!("Static part: {}", route.base);
|
||||
println!("Dynamic part: {}", route.dynamic);
|
||||
println!("\tStatic part: {}", route.base);
|
||||
println!("\tDynamic part: {}", route.dynamic);
|
||||
}
|
||||
else {
|
||||
println!("NOT FOUND: {}: {}", meth, path);
|
||||
println!("\tNOT FOUND: {}: {}", meth, path);
|
||||
*resp.status_mut() = StatusCode::NOT_FOUND
|
||||
}
|
||||
}
|
||||
@ -78,6 +77,7 @@ async fn main_responder(request: Request<Body>) -> Result<Response<Body>, hyper:
|
||||
let (parts, mut body) = request.into_parts();
|
||||
let method = parts.method;
|
||||
let path = parts.uri.path();
|
||||
println!("{}: {}", method, path);
|
||||
|
||||
let params_res = http_params::parse_params(&mut body).await;
|
||||
|
||||
@ -88,7 +88,7 @@ async fn main_responder(request: Request<Body>) -> Result<Response<Body>, hyper:
|
||||
match auth_result {
|
||||
OpenAuth | Good => route_dispatcher(&pool, &mut response, &method, path, params).await,
|
||||
NoKey => {
|
||||
println!("AUTH: NoKey/BadKey");
|
||||
println!("\tAUTH: NoKey/BadKey");
|
||||
*response.status_mut() = StatusCode::UNAUTHORIZED
|
||||
},
|
||||
}
|
||||
@ -98,7 +98,7 @@ async fn main_responder(request: Request<Body>) -> Result<Response<Body>, hyper:
|
||||
}
|
||||
}
|
||||
else {
|
||||
println!("PARSER: Parameter parsing failed");
|
||||
println!("\tPARSER: Parameter parsing failed");
|
||||
*response.status_mut() = StatusCode::BAD_REQUEST;
|
||||
}
|
||||
Ok(response)
|
||||
|
Loading…
Reference in New Issue
Block a user