|
1 | | -package graphql.spring.web.servlet.controller; |
| 1 | +package graphql.spring.web.servlet.components; |
2 | 2 |
|
3 | 3 |
|
4 | 4 | import com.fasterxml.jackson.databind.ObjectMapper; |
|
9 | 9 | import graphql.spring.web.servlet.GraphQLInvocationData; |
10 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 11 | import org.springframework.http.MediaType; |
12 | | -import org.springframework.http.server.ServerHttpResponse; |
13 | 12 | import org.springframework.web.bind.annotation.RequestBody; |
14 | 13 | import org.springframework.web.bind.annotation.RequestMapping; |
15 | 14 | import org.springframework.web.bind.annotation.RequestMethod; |
@@ -37,29 +36,27 @@ public class GraphQLController { |
37 | 36 | @RequestMapping(value = "${graphql.url:graphql}", |
38 | 37 | method = RequestMethod.POST, |
39 | 38 | consumes = MediaType.APPLICATION_JSON_VALUE, |
40 | | - produces = MediaType.APPLICATION_JSON_VALUE) |
| 39 | + produces = MediaType.APPLICATION_JSON_UTF8_VALUE) |
41 | 40 | public Object graphqlPOST(@RequestBody GraphQLRequestBody body, |
42 | | - WebRequest webRequest, |
43 | | - ServerHttpResponse serverHttpResponse) { |
| 41 | + WebRequest webRequest) { |
44 | 42 | String query = body.getQuery(); |
45 | 43 | if (query == null) { |
46 | 44 | query = ""; |
47 | 45 | } |
48 | 46 | CompletableFuture<ExecutionResult> executionResult = graphQLInvocation.invoke(new GraphQLInvocationData(query, body.getOperationName(), body.getVariables()), webRequest); |
49 | | - return executionResultHandler.handleExecutionResult(executionResult, serverHttpResponse); |
| 47 | + return executionResultHandler.handleExecutionResult(executionResult); |
50 | 48 | } |
51 | 49 |
|
52 | 50 | @RequestMapping(value = "${graphql.url:graphql}", |
53 | 51 | method = RequestMethod.GET, |
54 | | - produces = MediaType.APPLICATION_JSON_VALUE) |
| 52 | + produces = MediaType.APPLICATION_JSON_UTF8_VALUE) |
55 | 53 | public Object graphqlGET( |
56 | 54 | @RequestParam("query") String query, |
57 | 55 | @RequestParam(value = "operationName", required = false) String operationName, |
58 | 56 | @RequestParam(value = "variables", required = false) String variablesJson, |
59 | | - WebRequest webRequest, |
60 | | - ServerHttpResponse serverHttpResponse) { |
| 57 | + WebRequest webRequest) { |
61 | 58 | CompletableFuture<ExecutionResult> executionResult = graphQLInvocation.invoke(new GraphQLInvocationData(query, operationName, convertVariablesJson(variablesJson)), webRequest); |
62 | | - return executionResultHandler.handleExecutionResult(executionResult, serverHttpResponse); |
| 59 | + return executionResultHandler.handleExecutionResult(executionResult); |
63 | 60 | } |
64 | 61 |
|
65 | 62 | private Map<String, Object> convertVariablesJson(String jsonMap) { |
|
0 commit comments