Skip to content

Commit cd85c94

Browse files
committed
Add debug flags to graphQL server
1 parent a38882f commit cd85c94

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Infrastructure/Api/Http/Controller/GraphQLServerController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Jerowork\ExampleApplicationGraphqlAttributeSchema\Infrastructure\Api\Http\Controller;
66

7+
use GraphQL\Error\DebugFlag;
78
use GraphQL\Executor\ExecutionResult;
89
use GraphQL\Server\ServerConfig;
910
use GraphQL\Server\StandardServer;
@@ -49,10 +50,10 @@ public function __invoke(Request $request): Response
4950

5051
// 4. Handle batch requests
5152
if (is_array($result)) {
52-
return new JsonResponse(array_map(fn($res) => $res->toArray(), $result));
53+
return new JsonResponse(array_map(fn($res) => $res->toArray(DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE), $result));
5354
}
5455

5556
// 5. Return response
56-
return new JsonResponse($result->toArray());
57+
return new JsonResponse($result->toArray(DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE));
5758
}
5859
}

0 commit comments

Comments
 (0)