Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions src/AspNetCore/GraphQLHttpMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private bool IsGraphQlRequest(HttpContext context)
private async Task ExecuteAsync(HttpContext context, ISchema schema)
{
var request = Deserialize<GraphQLQuery>(context.Request.Body);

object userContext = null;
var userContextBuilder = context.RequestServices.GetService<IUserContextBuilder>();
if (userContextBuilder != null)
Expand All @@ -66,19 +66,16 @@ private async Task ExecuteAsync(HttpContext context, ISchema schema)
{
userContext = _options.BuildUserContext?.Invoke(context);
}

var result = await _executer.ExecuteAsync(x =>
var result = await _executer.ExecuteAsync(_ =>
{
x.Schema = schema;
x.Query = request.Query;
x.OperationName = request.OperationName;
x.Inputs = request.Variables.ToInputs();
x.UserContext = userContext;
x.ComplexityConfiguration = _options.ComplexityConfiguration;
x.EnableMetrics = _options.EnableMetrics;
x.ExposeExceptions = _options.ExposeExceptions;
x.SetFieldMiddleware = _options.SetFieldMiddleware;
x.ValidationRules = _options.ValidationRules.Concat(DocumentValidator.CoreRules()).ToList();
_.Schema = schema;
_.Query = request.Query;
_.OperationName = request.OperationName;
_.Inputs = request.Variables.ToInputs();
_.UserContext = userContext;
_.ExposeExceptions = _options.ExposeExceptions;
_.ValidationRules = _options.ValidationRules.Concat(DocumentValidator.CoreRules()).ToList();
});

await WriteResponseAsync(context, result);
Expand Down
7 changes: 0 additions & 7 deletions src/AspNetCore/GraphQLHttpOptions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using GraphQL.Validation;
using GraphQL.Validation.Complexity;
using Microsoft.AspNetCore.Http;

namespace GraphQL.Server.Transports.AspNetCore
Expand All @@ -12,14 +11,8 @@ public class GraphQLHttpOptions

public Func<HttpContext, object> BuildUserContext { get; set; }

public ComplexityConfiguration ComplexityConfiguration { get; set; }

public bool EnableMetrics { get; set; } = true;

public bool ExposeExceptions { get; set; }

public bool SetFieldMiddleware { get; set; } = true;

public IList<IValidationRule> ValidationRules { get; } = new List<IValidationRule>();
}
}