pub async fn handle_request(
    function: PyFunction,
    number_of_params: u8,
    headers: &Arc<Headers>,
    payload: &mut web::Payload,
    req: &HttpRequest,
    route_params: HashMap<String, String>,
    queries: HashMap<&str, &str>,
) -> HttpResponse {
    let contents = match execute_http_function(
        function,
        payload,
        headers,
        req,
        route_params,
        queries,
        number_of_params,
    )
    .await
    {
        Ok(res) => res,
        Err(err) => {
            println!("Error: {:?}", err);
            let mut response = HttpResponse::InternalServerError();
            apply_headers(&mut response, headers);
            return response.finish();
        }
    };

    let mut response = HttpResponse::Ok();
    apply_headers(&mut response, headers);
    response.body(contents)
}
/// This functions handles the incoming request matches it to the function and serves the response
///
/// # Arguments
///
/// * `function` - a PyFunction matched from the router
///
/// # Errors
///
/// When the route is not found. It should check if the 404 route exist and then serve it back
/// There can also be PyError due to any mis processing of the files
///
This functions handles the incoming request matches it to the function and serves the response
This functions handles the incoming request matches it to the function and serves the response
pub async fn handle_request(
    function: PyFunction,
    number_of_params: u8,
    headers: &Arc<Headers>,
    payload: &mut web::Payload,
    req: &HttpRequest,
    route_params: HashMap<String, String>,
    queries: HashMap<&str, &str>,
) -> HttpResponse {
    let contents = match execute_http_function(
        function,
        payload,
        headers,
        req,
        route_params,
        queries,
        number_of_params,
    )
    .await
    {
        Ok(res) => res,
        Err(err) => {
            println!("Error: {:?}", err);
            let mut response = HttpResponse::InternalServerError();
            apply_headers(&mut response, headers);
            return response.finish();
        }
    };
    let mut response = HttpResponse::Ok();
    apply_headers(&mut response, headers);
    response.body(contents)
}
pub async fn handle_request ( function : PyFunction , number_of_params : u8 , headers : & Arc < Headers > , payload : & mut web :: Payload , req : & HttpRequest , route_params : HashMap < String , String > , queries : HashMap < & str , & str > , ) -> HttpResponse { let contents = match execute_http_function ( function , payload , headers , req , route_params , queries , number_of_params , ) . await { Ok ( res ) => res , Err ( err ) => { println ! ( " " err ) ; let mut response = HttpResponse :: InternalServerError ( ) ; apply_headers ( & mut response , headers ) ; return response . finish ( ) ; } } ; let mut response = HttpResponse :: Ok ( ) ; apply_headers ( & mut response , headers ) ; response . body ( contents ) }
This functions handles the incoming request matches it to the function and serves the response
This functions handles the incoming request matches it to the function and serves the response
function
PyFunction
number_of_params
u8
headers
&Arc<Headers>
payload
&mut web::Payload
req
&HttpRequest
route_params
HashMap<String, String>
queries
HashMap<&str, &str>
function
PyFunction
number_of_params
u8
headers
&Arc<Headers>
payload
&mut web::Payload
req
&HttpRequest
route_params
HashMap<String, String>
queries
HashMap<&str, &str>
errors
When the route is not found. It should check if the 404 route exist and then serve it back
There can also be PyError due to any mis processing of the files
When the route is not found . It should check if the 404 route exist and then serve it back There can also be PyError due to any mis processing of the files