Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed defer execution. #5217

Merged
merged 8 commits into from
Jul 7, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using HttpRequestDelegate = Microsoft.AspNetCore.Http.RequestDelegate;
using static System.Net.HttpStatusCode;
using static HotChocolate.AspNetCore.ErrorHelper;
using static HotChocolate.SchemaSerializer;
using static HotChocolate.SchemaPrinter;
namespace HotChocolate.AspNetCore;

public sealed class HttpGetSchemaMiddleware : MiddlewareBase
Expand Down Expand Up @@ -113,14 +113,14 @@ coordinate.Value.MemberName is not null ||

context.Response.ContentType = ContentType.GraphQL;
context.Response.Headers.SetContentDisposition(GetTypesFileName(types));
await SerializeAsync(types, context.Response.Body, indent, context.RequestAborted);
await PrintAsync(types, context.Response.Body, indent, context.RequestAborted);
}

private async Task WriteSchemaAsync(HttpContext context, ISchema schema, bool indent)
{
context.Response.ContentType = ContentType.GraphQL;
context.Response.Headers.SetContentDisposition(GetSchemaFileName(schema));
await SerializeAsync(schema, context.Response.Body, indent, context.RequestAborted);
await PrintAsync(schema, context.Response.Body, indent, context.RequestAborted);
}

private string GetTypesFileName(List<INamedType> types)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ public EvictSchemaTests(TestServerFactory serverFactory)
public async Task Evict_Default_Schema()
{
// arrange
TestServer server = CreateStarWarsServer();
var server = CreateStarWarsServer();

ClientQueryResult time1 = await server.GetAsync(
var time1 = await server.GetAsync(
new ClientQueryRequest { Query = "{ time }" });

// act
await server.GetAsync(
new ClientQueryRequest { Query = "{ evict }" });

// assert
ClientQueryResult time2 = await server.GetAsync(
var time2 = await server.GetAsync(
new ClientQueryRequest { Query = "{ time }" });
Assert.False(((long)time1.Data["time"]).Equals((long)time2.Data["time"]));
}
Expand All @@ -35,9 +35,9 @@ await server.GetAsync(
public async Task Evict_Named_Schema()
{
// arrange
TestServer server = CreateStarWarsServer();
var server = CreateStarWarsServer();

ClientQueryResult time1 = await server.GetAsync(
var time1 = await server.GetAsync(
new ClientQueryRequest { Query = "{ time }" },
"/evict");

Expand All @@ -47,7 +47,7 @@ await server.GetAsync(
"/evict");

// assert
ClientQueryResult time2 = await server.GetAsync(
var time2 = await server.GetAsync(
new ClientQueryRequest { Query = "{ time }" },
"/evict");
Assert.False(((long)time1.Data["time"]).Equals((long)time2.Data["time"]));
Expand Down
Loading