athena_rs 3.3.0

Database gateway API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Retrieves the `X-Athena-Client` header that selects the Supabase/Postgres client.
use crate::api::headers::request_context::resolved_athena_client;
use actix_web::HttpRequest;

/// Returns the header value used to decide which downstream client should handle the request.
pub fn x_athena_client(req: &HttpRequest) -> String {
    if let Some(client_name) = resolved_athena_client(req) {
        return client_name;
    }

    req.headers()
        .get("X-Athena-Client")
        .and_then(|h| h.to_str().ok())
        .map(str::trim)
        .unwrap_or("")
        .to_string()
}