Skip to content

Endpoint Options

The UHeadlessEndpointOptions class provides configuration options for the UHeadless GraphQL endpoint. These options can be used to customize various aspects of the endpoint’s behavior.

UHeadlessEndpointOptions Properties

PropertyDescription
CorsPolicyThe alternate CORS policy to use for the endpoint. If not defined, the default CORS policy will be used.
GraphQLPathThe path where the GraphQL endpoint will be placed. By default, the endpoint is available at “/graphql”.
GraphQLServerOptionsThe options for configuring the GraphQL endpoint.

GraphQLServerOptions Properties

PropertyDescription
ToolThe options for configuring the GraphQL tool (e.g., Banana Cake Pop).
SocketsThe options for configuring GraphQL sockets.
AllowedGetOperationsSpecifies which GraphQL options are allowed on GET requests.
EnableGetRequestsSpecifies whether GraphQL HTTP GET requests are allowed.
EnforceGetRequestsPreflightHeaderSpecifies whether to enforce the preflight header for GraphQL HTTP GET requests.
EnableMultipartRequestsSpecifies whether GraphQL HTTP multipart requests are allowed.
EnforceMultipartRequestsPreflightHeaderSpecifies whether to enforce the preflight header for GraphQL HTTP multipart requests.
EnableSchemaRequestsSpecifies whether the GraphQL schema SDL can be downloaded.
EnableBatchingSpecifies whether request batching is enabled.

By using these options, you can customize the behavior of the UHeadless GraphQL endpoint to suit your application’s needs. These options allow you to configure CORS policies, set the GraphQL endpoint path, enable/disable various HTTP request types (such as GET and multipart requests), control schema downloads, and more.

To configure the endpoint options, use the .UseUHeadlessGraphQLEndpoint() method and provide an instance of UHeadlessEndpointOptions with the desired settings.

Example usage:

app.UseUHeadlessGraphQLEndpoint(new UHeadlessEndpointOptions
{
CorsPolicy = null,
GraphQLPath = "/graphql",
GraphQLServerOptions = new()
{
Tool = {
Enable = true
}
}
});