Table of Contents

Interface IHttpResponseFormatter

Namespace
HotChocolate.AspNetCore.Serialization
Assembly
HotChocolate.AspNetCore.dll

This interface specifies how a GraphQL result is formatted to a HTTP response.

public interface IHttpResponseFormatter

Methods

CreateRequestFlags(AcceptMediaType[])

Inspects the provided accept headers and creates GraphQL request flags to limit execution behaviors based on the request media types.

GraphQLRequestFlags CreateRequestFlags(AcceptMediaType[] acceptMediaTypes)

Parameters

acceptMediaTypes AcceptMediaType[]

The media types provided through the accept header.

Returns

GraphQLRequestFlags

Returns GraphQL request flags which specifies the allow execution engine capabilities.

FormatAsync(HttpResponse, IExecutionResult, AcceptMediaType[], HttpStatusCode?, CancellationToken)

Formats the given result into a HTTP response.

ValueTask FormatAsync(HttpResponse response, IExecutionResult result, AcceptMediaType[] acceptMediaTypes, HttpStatusCode? proposedStatusCode, CancellationToken cancellationToken)

Parameters

response HttpResponse

The HTTP response.

result IExecutionResult

The GraphQL execution result.

acceptMediaTypes AcceptMediaType[]

The media types provided through the accept header.

proposedStatusCode HttpStatusCode?

The proposed status code.

cancellationToken CancellationToken

The request cancellation token.

Returns

ValueTask