MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / cors_layer

Function cors_layer

crates/opencode-server/src/server.rs:470–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

468}
469
470fn 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
481pub async fn run_server(addr: SocketAddr) -> anyhow::Result<()> {
482 let state = Arc::new(ServerState::new_with_storage_for_url(format!("http://{}", addr)).await?);

Callers 2

run_serverFunction · 0.85
run_server_with_stateFunction · 0.85

Calls 1

newFunction · 0.85

Tested by

no test coverage detected