mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 13:29:21 +00:00
Make process_simple_route
async
This commit is contained in:
parent
1857ae5e08
commit
254b74282e
@ -202,7 +202,7 @@ impl FromRequest for CustomRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Process a "simple request" aka not a WebSocket request
|
/// Process a "simple request" aka not a WebSocket request
|
||||||
fn process_simple_route(route: &Route, req: &mut HttpRequestHandler) -> RequestResult {
|
async fn process_simple_route(route: &Route, req: &mut HttpRequestHandler) -> RequestResult {
|
||||||
if requests_limit_helper::trigger_before(req, route).is_err() {
|
if requests_limit_helper::trigger_before(req, route).is_err() {
|
||||||
req.too_many_requests("Too many request. Please try again later.")?;
|
req.too_many_requests("Too many request. Please try again later.")?;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ async fn process_request(custom_req: CustomRequest) -> HttpResponse {
|
|||||||
// Execute the request
|
// Execute the request
|
||||||
let mut request = HttpRequestHandler::new(custom_req.req, custom_req.body);
|
let mut request = HttpRequestHandler::new(custom_req.req, custom_req.body);
|
||||||
|
|
||||||
match process_simple_route(route, &mut request) {
|
match process_simple_route(route, &mut request).await {
|
||||||
|
|
||||||
// Set default error response if required
|
// Set default error response if required
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user