code cleanup
This commit is contained in:
parent
a908292008
commit
4beaacb6f4
|
@ -59,7 +59,7 @@ fn handle_request(req: Request<Body>) -> Response<Body> {
|
||||||
_ => http_error!(NOT_FOUND, format!("No such method '{} {}'\n", method, path)),
|
_ => http_error!(NOT_FOUND, format!("No such method '{} {}'\n", method, path)),
|
||||||
};
|
};
|
||||||
|
|
||||||
// handle auth
|
// fixme: handle auth
|
||||||
|
|
||||||
// extract param
|
// extract param
|
||||||
let param = match query {
|
let param = match query {
|
||||||
|
@ -67,10 +67,9 @@ fn handle_request(req: Request<Body>) -> Response<Body> {
|
||||||
match parse_query_string(data, &api_method.parameters, true) {
|
match parse_query_string(data, &api_method.parameters, true) {
|
||||||
Ok(query) => query,
|
Ok(query) => query,
|
||||||
Err(ref error_list) => {
|
Err(ref error_list) => {
|
||||||
let mut msg = String::from("");
|
let msg = error_list.iter().fold(String::from(""), |acc, item| {
|
||||||
for item in error_list {
|
acc + &item.to_string() + "\n"
|
||||||
msg = msg + &item.to_string() + "\n";
|
});
|
||||||
}
|
|
||||||
http_error!(BAD_REQUEST, msg);
|
http_error!(BAD_REQUEST, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue