Skip to main content

Module call_context

Module call_context 

Source
Expand description

Call context for server-side interceptors.

CallContext carries metadata about the current JSON-RPC or REST call, allowing ServerInterceptor implementations to make access-control and auditing decisions.

§HTTP headers

The http_headers field carries the raw HTTP request headers (lowercased keys, last-value-wins for duplicates). This enables interceptors to inspect Authorization, X-Request-ID, or any other header without coupling the SDK to a specific HTTP library.

use a2a_protocol_server::CallContext;

let ctx = CallContext::new("SendMessage")
    .with_http_header("authorization", "Bearer tok_abc123")
    .with_http_header("x-request-id", "req-42");

assert_eq!(ctx.http_headers().get("authorization").map(String::as_str),
           Some("Bearer tok_abc123"));

Structs§

CallContext
Metadata about the current server-side method call.