Download server/src/proxy/middleware/cors.rs from AZILS/gemini: direct link, hf CLI and curl.
- Browser
- Download file 411 Bytes
-
https://huggingface.co/spaces/AZILS/gemini/resolve/main/server/src/proxy/middleware/cors.rs
- Command line
-
hf download hf://spaces/AZILS/gemini/server/src/proxy/middleware/cors.rs
-
curl -L -o cors.rs https://huggingface.co/spaces/AZILS/gemini/resolve/main/server/src/proxy/middleware/cors.rs
411 Bytes
| // CORS 中间件 | |
| use tower_http::cors::{CorsLayer, Any}; | |
| /// 创建 CORS layer | |
| pub fn cors_layer() -> CorsLayer { | |
| CorsLayer::new() | |
| .allow_origin(Any) | |
| .allow_methods(Any) | |
| .allow_headers(Any) | |
| } | |
| mod tests { | |
| use super::*; | |
| fn test_cors_layer_creation() { | |
| let _layer = cors_layer(); | |
| // Layer 创建成功 | |
| assert!(true); | |
| } | |
| } | |