diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/DefaultHttpMethod.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/DefaultHttpMethod.cs
index 4cbb2b624bc..fbc1de92891 100644
--- a/src/HotChocolate/AspNetCore/src/AspNetCore/DefaultHttpMethod.cs
+++ b/src/HotChocolate/AspNetCore/src/AspNetCore/DefaultHttpMethod.cs
@@ -1,7 +1,17 @@
namespace HotChocolate.AspNetCore;
+///
+/// The default HTTP fetch method for Banana Cake Pop.
+///
public enum DefaultHttpMethod
{
+ ///
+ /// Use a GraphQL HTTP GET request.
+ ///
Get,
+
+ ///
+ /// Use a GraphQL HTTP Post request.
+ ///
Post
}
diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Serialization/DefaultHttpResponseFormatter.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Serialization/DefaultHttpResponseFormatter.cs
index 8179a994093..9bf82ba44e0 100644
--- a/src/HotChocolate/AspNetCore/src/AspNetCore/Serialization/DefaultHttpResponseFormatter.cs
+++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Serialization/DefaultHttpResponseFormatter.cs
@@ -299,7 +299,7 @@ public class DefaultHttpResponseFormatter : IHttpResponseFormatter
var mediaType = acceptMediaTypes[0];
if (resultKind is ResultKind.Single &&
- mediaType.Kind is ApplicationGraphQL or AllApplication or All)
+ mediaType.Kind is ApplicationGraphQL or AllApplication)
{
formatInfo = new FormatInfo(
ContentType.GraphQLResponse,
@@ -309,7 +309,7 @@ public class DefaultHttpResponseFormatter : IHttpResponseFormatter
}
if (resultKind is ResultKind.Single &&
- mediaType.Kind is ApplicationJson)
+ mediaType.Kind is ApplicationJson or All)
{
formatInfo = new FormatInfo(
ContentType.Json,
@@ -350,7 +350,7 @@ public class DefaultHttpResponseFormatter : IHttpResponseFormatter
var mediaType = Unsafe.Add(ref searchSpace, i);
if (resultKind is ResultKind.Single &&
- mediaType.Kind is ApplicationGraphQL or AllApplication or All)
+ mediaType.Kind is ApplicationGraphQL or AllApplication)
{
formatInfo = new FormatInfo(
ContentType.GraphQLResponse,
@@ -360,7 +360,7 @@ public class DefaultHttpResponseFormatter : IHttpResponseFormatter
}
if (resultKind is ResultKind.Single &&
- mediaType.Kind is ApplicationJson)
+ mediaType.Kind is ApplicationJson or All)
{
// application/json is a legacy response content-type.
// We will create a formatInfo but keep on validating for
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/QueryExtension.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/QueryExtension.cs
index 3e31cc3d692..1582547fd36 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/QueryExtension.cs
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/QueryExtension.cs
@@ -16,4 +16,10 @@ public bool Evict([FromServices] IRequestExecutorResolver executorResolver, ISch
executorResolver.EvictRequestExecutor(schema.Name);
return true;
}
+
+ public async Task Wait(int m, CancellationToken ct)
+ {
+ await Task.Delay(m, ct);
+ return true;
+ }
}
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs
index 94bf09c2680..d4db3293ced 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs
@@ -385,7 +385,7 @@ public async Task New_Query_No_Streams_4()
///
/// This request specifies the */* accept header.
- /// expected response content-type: application/graphql-response+json; charset=utf-8
+ /// expected response content-type: application/json; charset=utf-8
/// expected status code: 200
///
[Fact]
@@ -412,14 +412,14 @@ public async Task New_Query_No_Streams_5()
using var response = await client.SendAsync(request);
// assert
- // expected response content-type: application/graphql-response+json; charset=utf-8
+ // expected response content-type: application/json; charset=utf-8
// expected status code: 200
Snapshot
.Create()
.Add(response)
.MatchInline(
@"Headers:
- Content-Type: application/graphql-response+json; charset=utf-8
+ Content-Type: application/json; charset=utf-8
-------------------------->
Status Code: OK
-------------------------->
@@ -862,7 +862,8 @@ public async Task New_Query_With_Streams_3()
Status Code: OK
-------------------------->
{""event"":""next"",""data"":{""data"":{},""hasNext"":true}}
- {""event"":""next"",""data"":{""path"":[],""data"":{""__typename"":""Query""},""hasNext"":false}}
+ {""event"":""next"",""data"":{""incremental"":[{""data"":{" +
+ @"""__typename"":""Query""},""path"":[]}],""hasNext"":false}}
{""event"":""complete""}
");
}
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpPostMiddlewareTests.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpPostMiddlewareTests.cs
index 9f739b8cb56..303359fa87c 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpPostMiddlewareTests.cs
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/HttpPostMiddlewareTests.cs
@@ -240,6 +240,9 @@ public async Task SingleRequest_Defer_Results()
{
Query = @"
{
+ ... @defer {
+ wait(m: 300)
+ }
hero(episode: NEW_HOPE)
{
name
@@ -271,6 +274,9 @@ public async Task Single_Diagnostic_Listener_Is_Triggered()
{
Query = @"
{
+ ... @defer {
+ wait(m: 300)
+ }
hero(episode: NEW_HOPE)
{
name
@@ -304,6 +310,9 @@ public async Task Aggregate_Diagnostic_All_Listeners_Are_Triggered()
{
Query = @"
{
+ ... @defer {
+ wait(m: 300)
+ }
hero(episode: NEW_HOPE)
{
name
@@ -332,6 +341,9 @@ public async Task Ensure_Multipart_Format_Is_Correct_With_Defer()
{
Query = @"
{
+ ... @defer {
+ wait(m: 300)
+ }
hero(episode: NEW_HOPE)
{
name
@@ -359,6 +371,9 @@ public async Task Ensure_Multipart_Format_Is_Correct_With_Defer_If_Condition_Tru
{
Query = @"
query ($if: Boolean!){
+ ... @defer {
+ wait(m: 300)
+ }
hero(episode: NEW_HOPE)
{
name
@@ -421,6 +436,9 @@ public async Task Ensure_Multipart_Format_Is_Correct_With_Stream()
{
Query = @"
{
+ ... @defer {
+ wait(m: 300)
+ }
hero(episode: NEW_HOPE)
{
name
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL.snap
index 80807c57733..e32912bb51a 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL.snap
@@ -74,6 +74,7 @@ type Query {
droid(id: String): Droid
time: Long!
evict: Boolean!
+ wait(m: Int!): Boolean!
}
type Review {
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route.snap
index 80807c57733..e32912bb51a 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route.snap
@@ -74,6 +74,7 @@ type Query {
droid(id: String): Droid
time: Long!
evict: Boolean!
+ wait(m: Int!): Boolean!
}
type Review {
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route_Explicit_Pattern.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route_Explicit_Pattern.snap
index 80807c57733..e32912bb51a 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route_Explicit_Pattern.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route_Explicit_Pattern.snap
@@ -74,6 +74,7 @@ type Query {
droid(id: String): Droid
time: Long!
evict: Boolean!
+ wait(m: Int!): Boolean!
}
type Review {
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Types_SDL.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Types_SDL.snap
index 17147636b80..6c224e62101 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Types_SDL.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Types_SDL.snap
@@ -7,4 +7,5 @@ type Query {
droid(id: String): Droid
time: Long!
evict: Boolean!
+ wait(m: Int!): Boolean!
}
\ No newline at end of file
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Types_SDL_Character_and_Query.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Types_SDL_Character_and_Query.snap
index 3c873505da1..2a79a63d9e1 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Types_SDL_Character_and_Query.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpGetSchemaMiddlewareTests.Download_GraphQL_Types_SDL_Character_and_Query.snap
@@ -15,4 +15,5 @@ type Query {
droid(id: String): Droid
time: Long!
evict: Boolean!
+ wait(m: Int!): Boolean!
}
\ No newline at end of file
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Defer.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Defer.snap
index df8d19e76af..0f0c4e7f9ce 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Defer.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Defer.snap
@@ -6,5 +6,9 @@ Content-Type: application/json; charset=utf-8
---
Content-Type: application/json; charset=utf-8
-{"incremental":[{"data":{"id":"2001"},"label":"my_id","path":["hero"]}],"hasNext":false}
+{"incremental":[{"data":{"id":"2001"},"label":"my_id","path":["hero"]}],"hasNext":true}
+---
+Content-Type: application/json; charset=utf-8
+
+{"incremental":[{"data":{"wait":true},"path":[]}],"hasNext":false}
-----
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Defer_If_Condition_True.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Defer_If_Condition_True.snap
index df8d19e76af..0f0c4e7f9ce 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Defer_If_Condition_True.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Defer_If_Condition_True.snap
@@ -6,5 +6,9 @@ Content-Type: application/json; charset=utf-8
---
Content-Type: application/json; charset=utf-8
-{"incremental":[{"data":{"id":"2001"},"label":"my_id","path":["hero"]}],"hasNext":false}
+{"incremental":[{"data":{"id":"2001"},"label":"my_id","path":["hero"]}],"hasNext":true}
+---
+Content-Type: application/json; charset=utf-8
+
+{"incremental":[{"data":{"wait":true},"path":[]}],"hasNext":false}
-----
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Stream.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Stream.snap
index 97dfd3e47e9..fe8822d442a 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Stream.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.Ensure_Multipart_Format_Is_Correct_With_Stream.snap
@@ -6,9 +6,9 @@ Content-Type: application/json; charset=utf-8
---
Content-Type: application/json; charset=utf-8
-{"incremental":[{"data":{"name":"Han Solo"},"label":"foo","path":["hero","friends","nodes",1]},{"data":{"name":"Leia Organa"},"label":"foo","path":["hero","friends","nodes",2]}],"hasNext":true}
+{"incremental":[{"items":[{"name":"Han Solo"}],"label":"foo","path":["hero","friends","nodes",1]},{"items":[{"name":"Leia Organa"}],"label":"foo","path":["hero","friends","nodes",2]}],"hasNext":true}
---
Content-Type: application/json; charset=utf-8
-{"hasNext":false}
+{"incremental":[{"data":{"wait":true},"path":[]}],"hasNext":false}
-----
diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.SingleRequest_Defer_Results.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.SingleRequest_Defer_Results.snap
index 098c281a900..77d47381062 100644
--- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.SingleRequest_Defer_Results.snap
+++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/__snapshots__/HttpPostMiddlewareTests.SingleRequest_Defer_Results.snap
@@ -1,5 +1,5 @@
{
"ContentType": "multipart/mixed; boundary=\"-\"; charset=utf-8",
"StatusCode": "OK",
- "Content": "\r\n---\r\nContent-Type: application/json; charset=utf-8\r\n\r\n{\"data\":{\"hero\":{\"name\":\"R2-D2\"}},\"hasNext\":true}\r\n---\r\nContent-Type: application/json; charset=utf-8\r\n\r\n{\"incremental\":[{\"data\":{\"id\":\"2001\"},\"label\":\"my_id\",\"path\":[\"hero\"]}],\"hasNext\":false}\r\n-----\r\n"
+ "Content": "\r\n---\r\nContent-Type: application/json; charset=utf-8\r\n\r\n{\"data\":{\"hero\":{\"name\":\"R2-D2\"}},\"hasNext\":true}\r\n---\r\nContent-Type: application/json; charset=utf-8\r\n\r\n{\"incremental\":[{\"data\":{\"id\":\"2001\"},\"label\":\"my_id\",\"path\":[\"hero\"]}],\"hasNext\":true}\r\n---\r\nContent-Type: application/json; charset=utf-8\r\n\r\n{\"incremental\":[{\"data\":{\"wait\":true},\"path\":[]}],\"hasNext\":false}\r\n-----\r\n"
}
\ No newline at end of file
diff --git a/src/HotChocolate/Core/src/Abstractions/Execution/IQueryResult.cs b/src/HotChocolate/Core/src/Abstractions/Execution/IQueryResult.cs
index d7489d31f64..7a8643ea654 100644
--- a/src/HotChocolate/Core/src/Abstractions/Execution/IQueryResult.cs
+++ b/src/HotChocolate/Core/src/Abstractions/Execution/IQueryResult.cs
@@ -29,6 +29,15 @@ public interface IQueryResult : IExecutionResult
///
IReadOnlyDictionary? Data { get; }
+ ///
+ /// The `items` entry in a stream payload is a list of results from the execution of
+ /// the associated @stream directive. This output will be a list of the same type of
+ /// the field with the associated `@stream` directive. If `items` is set to `null`,
+ /// it indicates that an error has caused a `null` to bubble up to a field higher
+ /// than the list field with the associated `@stream` directive.
+ ///
+ IReadOnlyList