diff --git a/samples/OcelotGraphQL/OcelotGraphQL.csproj b/samples/OcelotGraphQL/OcelotGraphQL.csproj
index 271ae56f..f205c25e 100644
--- a/samples/OcelotGraphQL/OcelotGraphQL.csproj
+++ b/samples/OcelotGraphQL/OcelotGraphQL.csproj
@@ -12,6 +12,6 @@
-
+
diff --git a/samples/OcelotGraphQL/Program.cs b/samples/OcelotGraphQL/Program.cs
index a1824057..ef23d98d 100644
--- a/samples/OcelotGraphQL/Program.cs
+++ b/samples/OcelotGraphQL/Program.cs
@@ -1,133 +1,138 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
-using Ocelot.Middleware;
-using Ocelot.DependencyInjection;
-using GraphQL.Types;
-using GraphQL;
-using Ocelot.Requester;
-using Ocelot.Responses;
-using System.Net.Http;
-using System.Net;
-using Microsoft.Extensions.DependencyInjection;
-using System.Threading;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
+using Ocelot.Middleware;
+using Ocelot.DependencyInjection;
+using GraphQL.Types;
+using GraphQL;
+using Ocelot.Requester;
+using Ocelot.Responses;
+using System.Net.Http;
+using System.Net;
+using Microsoft.Extensions.DependencyInjection;
+using System.Threading;
+
+namespace OcelotGraphQL
+{
+ public class Hero
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ }
+
+ public class Query
+ {
+ private readonly List _heroes = new List
+ {
+ new Hero { Id = 1, Name = "R2-D2" },
+ new Hero { Id = 2, Name = "Batman" },
+ new Hero { Id = 3, Name = "Wonder Woman" },
+ new Hero { Id = 4, Name = "Tom Pallister" }
+ };
+
+ [GraphQLMetadata("hero")]
+ public Hero GetHero(int id)
+ {
+ return _heroes.FirstOrDefault(x => x.Id == id);
+ }
+ }
+
+ public class GraphQlDelegatingHandler : DelegatingHandler
+ {
+ //private readonly ISchema _schema;
+ private readonly IDocumentExecuter _executer;
+ private readonly IDocumentWriter _writer;
+
+ public GraphQlDelegatingHandler(IDocumentExecuter executer, IDocumentWriter writer)
+ {
+ _executer = executer;
+ _writer = writer;
+ }
+
+ protected async override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
+ {
+ //try get query from body, could check http method :)
+ var query = await request.Content.ReadAsStringAsync();
+
+ //if not body try query string, dont hack like this in real world..
+ if (query.Length == 0)
+ {
+ var decoded = WebUtility.UrlDecode(request.RequestUri.Query);
+ query = decoded.Replace("?query=", "");
+ }
-namespace OcelotGraphQL
-{
- public class Hero
- {
- public int Id { get; set; }
- public string Name { get; set; }
- }
-
- public class Query
- {
- private readonly List _heroes = new List
- {
- new Hero { Id = 1, Name = "R2-D2" },
- new Hero { Id = 2, Name = "Batman" },
- new Hero { Id = 3, Name = "Wonder Woman" },
- new Hero { Id = 4, Name = "Tom Pallister" }
- };
-
- [GraphQLMetadata("hero")]
- public Hero GetHero(int id)
- {
- return _heroes.FirstOrDefault(x => x.Id == id);
- }
- }
-
- public class GraphQlDelegatingHandler : DelegatingHandler
- {
- private readonly ISchema _schema;
-
- public GraphQlDelegatingHandler(ISchema schema)
- {
- _schema = schema;
- }
-
- protected async override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
- {
- //try get query from body, could check http method :)
- var query = await request.Content.ReadAsStringAsync();
-
- //if not body try query string, dont hack like this in real world..
- if (query.Length == 0)
- {
- var decoded = WebUtility.UrlDecode(request.RequestUri.Query);
- query = decoded.Replace("?query=", "");
- }
-
- var result = _schema.Execute(_ =>
- {
- _.Query = query;
+ var result = await _executer.ExecuteAsync(_ =>
+ {
+ _.Query = query;
});
- //maybe check for errors and headers etc in real world?
- var response = new HttpResponseMessage(HttpStatusCode.OK)
- {
- Content = new StringContent(result)
- };
+ var responseBody = await _writer.WriteToStringAsync(result);
- //ocelot will treat this like any other http request...
- return response;
- }
- }
-
- public class Program
- {
- public static void Main()
- {
- var schema = Schema.For(@"
- type Hero {
- id: Int
- name: String
- }
-
- type Query {
- hero(id: Int): Hero
- }
- ", _ =>
- {
- _.Types.Include();
- });
-
- new WebHostBuilder()
- .UseKestrel()
- .UseContentRoot(Directory.GetCurrentDirectory())
- .ConfigureAppConfiguration((hostingContext, config) =>
- {
- config
- .SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
- .AddJsonFile("appsettings.json", true, true)
- .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
- .AddJsonFile("ocelot.json", false, false)
- .AddEnvironmentVariables();
- })
- .ConfigureServices(s =>
- {
- s.AddSingleton(schema);
- s.AddOcelot()
- .AddDelegatingHandler();
- })
- .ConfigureLogging((hostingContext, logging) =>
- {
- logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
- logging.AddConsole();
- })
- .UseIISIntegration()
- .Configure(app =>
- {
- app.UseOcelot().Wait();
- })
- .Build()
- .Run();
- }
- }
-}
+ //maybe check for errors and headers etc in real world?
+ var response = new HttpResponseMessage(HttpStatusCode.OK)
+ {
+ Content = new StringContent(responseBody)
+ };
+
+ //ocelot will treat this like any other http request...
+ return response;
+ }
+ }
+
+ public class Program
+ {
+ public static void Main()
+ {
+ var schema = Schema.For(@"
+ type Hero {
+ id: Int
+ name: String
+ }
+
+ type Query {
+ hero(id: Int): Hero
+ }
+ ", _ =>
+ {
+ _.Types.Include();
+ });
+
+ new WebHostBuilder()
+ .UseKestrel()
+ .UseContentRoot(Directory.GetCurrentDirectory())
+ .ConfigureAppConfiguration((hostingContext, config) =>
+ {
+ config
+ .SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
+ .AddJsonFile("appsettings.json", true, true)
+ .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
+ .AddJsonFile("ocelot.json", false, false)
+ .AddEnvironmentVariables();
+ })
+ .ConfigureServices(s =>
+ {
+ s.AddSingleton(schema);
+ s.AddOcelot()
+ .AddDelegatingHandler();
+ })
+ .ConfigureLogging((hostingContext, logging) =>
+ {
+ logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
+ logging.AddConsole();
+ })
+ .UseIISIntegration()
+ .Configure(app =>
+ {
+ app.UseOcelot().Wait();
+ })
+ .Build()
+ .Run();
+ }
+ }
+}
diff --git a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj
index 88a6afc3..13472b02 100644
--- a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj
+++ b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj
@@ -27,7 +27,7 @@
-
+
all
diff --git a/src/Ocelot/Ocelot.csproj b/src/Ocelot/Ocelot.csproj
index 1481b83c..f925df8a 100644
--- a/src/Ocelot/Ocelot.csproj
+++ b/src/Ocelot/Ocelot.csproj
@@ -24,7 +24,7 @@
-
+
NU1701
diff --git a/src/Ocelot/Responses/Response.cs b/src/Ocelot/Responses/Response.cs
index a10d480b..7158f010 100644
--- a/src/Ocelot/Responses/Response.cs
+++ b/src/Ocelot/Responses/Response.cs
@@ -1,22 +1,22 @@
-using Ocelot.Errors;
-using System.Collections.Generic;
-
-namespace Ocelot.Responses
-{
- public abstract class Response
- {
- protected Response()
- {
- Errors = new List();
- }
-
- protected Response(List errors)
- {
- Errors = errors ?? new List();
+using Ocelot.Errors;
+using System.Collections.Generic;
+
+namespace Ocelot.Responses
+{
+ public abstract class Response
+ {
+ protected Response()
+ {
+ Errors = new List();
}
- public List Errors { get; }
-
- public bool IsError => Errors.Count > 0;
- }
+ protected Response(List errors)
+ {
+ Errors = errors ?? new List();
+ }
+
+ public List Errors { get; }
+
+ public bool IsError => Errors.Count > 0;
+ }
}
diff --git a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj
index 2552ec47..193ce9db 100644
--- a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj
+++ b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj
@@ -65,7 +65,7 @@
-
+
diff --git a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj
index cd3c62b7..99d9b0c6 100644
--- a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj
+++ b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj
@@ -18,7 +18,7 @@
-
+
all
diff --git a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj
index a9ba3bfc..439d72f3 100644
--- a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj
+++ b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj
@@ -75,7 +75,7 @@
-
+