//! Call core `GET /ok` with the in-memory adapter and **no** plugins.

use athena_auth::{AuthBuilder, AuthConfig, AuthRequest, HttpMethod, MemoryDatabaseAdapter};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let config = AuthConfig::new("test-secret-key-that-is-at-least-32-characters-long");
    let auth = AuthBuilder::new(config)
        .database(MemoryDatabaseAdapter::new())
        .build()
        .await?;

    let resp = auth
        .handle_request(AuthRequest::new(HttpMethod::Get, "/ok"))
        .await?;
    println!(
        "HTTP {} — {}",
        resp.status,
        String::from_utf8_lossy(&resp.body)
    );
    Ok(())
}
