@@ -364,7 +364,7 @@ private void query(GraphQLQueryInvoker queryInvoker, GraphQLObjectMapper graphQL
364
364
if (!(result .getData () instanceof Publisher || isDeferred )) {
365
365
resp .setContentType (APPLICATION_JSON_UTF8 );
366
366
resp .setStatus (STATUS_OK );
367
- resp .getWriter (). write ( graphQLObjectMapper . serializeResultAsJson ( result ) );
367
+ graphQLObjectMapper . serializeResultAsJson ( resp .getWriter (), result );
368
368
} else {
369
369
if (req == null ) {
370
370
throw new IllegalStateException ("Http servlet request can not be null" );
@@ -414,7 +414,7 @@ private void queryBatched(GraphQLQueryInvoker queryInvoker, GraphQLBatchedInvoca
414
414
writer .write ("[" );
415
415
GraphQLObjectMapper graphQLObjectMapper = configuration .getObjectMapper ();
416
416
while (executionInputIterator .hasNext ()) {
417
- writer . write ( graphQLObjectMapper .serializeResultAsJson (executionInputIterator .next () ));
417
+ graphQLObjectMapper .serializeResultAsJson (writer , executionInputIterator .next ());
418
418
if (executionInputIterator .hasNext ()) {
419
419
writer .write ("," );
420
420
}
@@ -558,7 +558,9 @@ public void onSubscribe(Subscription subscription) {
558
558
public void onNext (ExecutionResult executionResult ) {
559
559
try {
560
560
Writer writer = asyncContext .getResponse ().getWriter ();
561
- writer .write ("data: " + graphQLObjectMapper .serializeResultAsJson (executionResult ) + "\n \n " );
561
+ writer .write ("data: " );
562
+ graphQLObjectMapper .serializeResultAsJson (writer , executionResult );
563
+ writer .write ("\n \n " );
562
564
writer .flush ();
563
565
subscriptionRef .get ().request (1 );
564
566
} catch (IOException ignored ) {
0 commit comments