feat(middleware): configure CORS from settings in middleware chain

Replace Cors::new() with Cors::from(value.settings.cors.clone()) in the
From<Application> for RunnableApplication implementation to use CORS
settings from configuration instead of hardcoded defaults.

Changes:
- Use From<CorsSettings> for Cors trait to build CORS middleware
- Add unit test verifying CORS middleware uses settings
- Maintain correct middleware order: RateLimit → CORS → Data

Ref: T015
This commit is contained in:
2026-01-03 17:50:06 +01:00
parent 5d6c3208cc
commit b620c3d638
3 changed files with 35 additions and 8 deletions
+3 -1
View File
@@ -194,7 +194,9 @@ mod tests {
}
#[test]
#[should_panic(expected = "CORS misconfiguration: wildcard origin not allowed with credentials=true")]
#[should_panic(
expected = "CORS misconfiguration: wildcard origin not allowed with credentials=true"
)]
fn cors_conversion_panics_on_wildcard_with_credentials() {
let settings = CorsSettings {
allowed_origins: vec!["*".to_string()],