INNER CODE UNIT · Rust

initialize_challenge

modelcontextprotocol/rust-sdk · conformance/src/bin/client.rs:225

async fn initialize_challenge(
    server_url: &str,
    lifecycle: ClientLifecycleMode,
) -> anyhow::Result<Option<String>> {
    let transport = StreamableHttpClientTransport::from_uri(server_url);
    match BasicClientHandler
        .serve_with_lifecycle(transport, lifecycle)
        .await
    {
        Ok(client) => {
            client.cancel().await.ok();
            Ok(None)
        }
        Err(error) => match error.auth_challenge() {
            Some(challenge) => Ok(Some(challenge.to_string())),
            None => Err(error.into()),
        },
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…