use warp::http; use warp::Filter; const MAX: u64 = 1024 * 1024 * 1024 * 4; // 4 GiB pub fn config() -> impl Filter + Clone { // Set base path let base = warp::path("import").and(warp::path::end()); // Set opts method let opts = base.and(warp::options()).map(warp::reply); // Set post method let post = base .and(warp::post()) .and(warp::body::content_length_limit(MAX)) .and_then(handler); // Specify route opts.or(post) } async fn handler() -> Result { Ok(warp::reply::with_status("Ok", http::StatusCode::OK)) }