fraiseql-server 2.2.0

HTTP server for FraiseQL v2 GraphQL engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Well-known endpoints (RFC 5785).
//!
//! Currently provides `/.well-known/security.txt` (RFC 9116).

use axum::{
    extract::State,
    http::{StatusCode, header},
    response::IntoResponse,
};

/// Handler for `/.well-known/security.txt`.
///
/// Returns an RFC 9116 security.txt with the configured contact email.
pub async fn security_txt_handler(State(contact): State<String>) -> impl IntoResponse {
    let body = format!("Contact: mailto:{contact}\nPreferred-Languages: en\n");
    (StatusCode::OK, [(header::CONTENT_TYPE, "text/plain; charset=utf-8")], body)
}