1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-28 01:52:57 +01:00

Separate medium & large, make large bigger

This commit is contained in:
asonix 2024-05-19 17:06:05 -05:00
parent a94b5b89a5
commit 69ca0e7c57

View File

@ -5,6 +5,7 @@ use actix_server::Server;
use actix_service::map_config; use actix_service::map_config;
use actix_web::{dev::AppConfig, get, App}; use actix_web::{dev::AppConfig, get, App};
static MEDIUM: OnceLock<String> = OnceLock::new();
static LARGE: OnceLock<String> = OnceLock::new(); static LARGE: OnceLock<String> = OnceLock::new();
#[get("/")] #[get("/")]
@ -14,12 +15,12 @@ async fn index() -> &'static str {
#[get("/large")] #[get("/large")]
async fn large() -> &'static str { async fn large() -> &'static str {
LARGE.get_or_init(|| "123456890".repeat(1024 * 10)) LARGE.get_or_init(|| "123456890".repeat(1024 * 100))
} }
#[get("/medium")] #[get("/medium")]
async fn medium() -> &'static str { async fn medium() -> &'static str {
LARGE.get_or_init(|| "123456890".repeat(1024 * 5)) MEDIUM.get_or_init(|| "123456890".repeat(1024 * 5))
} }
#[tokio::main(flavor = "current_thread")] #[tokio::main(flavor = "current_thread")]