use of org.hyperledger.besu.ethereum.api.graphql.internal.response.GraphQLSuccessResponse in project besu by hyperledger.
the class GraphQLHttpService method process.
private GraphQLResponse process(final String requestJson, final String operationName, final Map<String, Object> variables) {
Map<GraphQLContextType, Object> contextMap = new ConcurrentHashMap<>();
contextMap.putAll(graphQlContextMap);
contextMap.put(GraphQLContextType.IS_ALIVE_HANDLER, new IsAliveHandler(scheduler, config.getHttpTimeoutSec()));
final ExecutionInput executionInput = ExecutionInput.newExecutionInput().query(requestJson).operationName(operationName).variables(variables).graphQLContext(contextMap).build();
final ExecutionResult result = graphQL.execute(executionInput);
final Map<String, Object> toSpecificationResult = result.toSpecification();
final List<GraphQLError> errors = result.getErrors();
if (errors.size() == 0) {
return new GraphQLSuccessResponse(toSpecificationResult);
} else {
return new GraphQLErrorResponse(toSpecificationResult);
}
}
Aggregations