Skip to main content

graphql_handler

Function graphql_handler 

Source
pub async fn graphql_handler<A: DatabaseAdapter + Clone + Send + Sync + 'static>(
    __arg0: State<AppState<A>>,
    headers: HeaderMap,
    __arg2: OptionalSecurityContext,
    __arg3: Json<GraphQLRequest>,
) -> Result<GraphQLResponse, ErrorResponse>
Expand description

GraphQL HTTP handler for POST requests.

Handles POST requests to the GraphQL endpoint:

  1. Extract W3C trace context from traceparent header (if present)
  2. Validate GraphQL request (depth, complexity)
  3. Parse GraphQL request body
  4. Execute query via Executor with optional SecurityContext
  5. Return GraphQL response with proper error formatting

Tracks execution timing and operation name for monitoring. Provides GraphQL spec-compliant error responses. Supports W3C Trace Context for distributed tracing. Supports OIDC authentication for RLS policy evaluation.

ยงErrors

Returns appropriate HTTP status codes based on error type.