()
| 468 | } |
| 469 | |
| 470 | fn cors_layer() -> CorsLayer { |
| 471 | CorsLayer::new() |
| 472 | .allow_origin(AllowOrigin::predicate( |
| 473 | |origin: &HeaderValue, _parts: &Parts| { |
| 474 | origin.to_str().map(is_allowed_origin).unwrap_or(false) |
| 475 | }, |
| 476 | )) |
| 477 | .allow_methods(Any) |
| 478 | .allow_headers(Any) |
| 479 | } |
| 480 | |
| 481 | pub async fn run_server(addr: SocketAddr) -> anyhow::Result<()> { |
| 482 | let state = Arc::new(ServerState::new_with_storage_for_url(format!("http://{}", addr)).await?); |
no test coverage detected