Ejemplo n.º 1
0
        private async Task ExecuteOperationBatchAsync(
            HttpContext context,
            IServiceProvider services,
            GraphQLRequest request,
            IReadOnlyList <string> operationNames)
        {
            IReadOnlyList <IReadOnlyQueryRequest> requestBatch =
                await BuildBatchRequestAsync(
                    context, services, request, operationNames)
                .ConfigureAwait(false);

            IResponseStream responseStream = await _batchExecutor
                                             .ExecuteAsync(requestBatch, context.GetCancellationToken())
                                             .ConfigureAwait(false);

            SetResponseHeaders(
                context.Response,
                _streamSerializer.ContentType);

            await _streamSerializer.SerializeAsync(
                responseStream,
                context.Response.Body,
                context.GetCancellationToken())
            .ConfigureAwait(false);
        }
Ejemplo n.º 2
0
        private async Task ExecuteOperationBatchAsync(
            HttpHelper httpHelper,
            GraphQLRequest request,
            IReadOnlyList <string> operationNames)
        {
            IReadOnlyList <IReadOnlyQueryRequest> requestBatch =
                await BuildBatchRequestAsync(
                    httpHelper.Context, httpHelper.Services, request, operationNames)
                .ConfigureAwait(false);

            httpHelper.StatusCode       = OK;
            httpHelper.StreamSerializer = _streamSerializer;
            httpHelper.Result           = await _batchExecutor
                                          .ExecuteAsync(requestBatch, httpHelper.Context.RequestAborted)
                                          .ConfigureAwait(false);
        }