MCPcopy Create free account
hub / github.com/dgraph-io/dgraph4j / GraphQLRequest

Class GraphQLRequest

src/test/java/io/dgraph/TestUtil.java:28–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 "http://" + TEST_HOSTNAME + ":" + TEST_HTTP_PORT + "/admin";
27
28 private static class GraphQLRequest {
29 public String query;
30 public Map<String, Object> variables;
31
32 // excluded from serialization/deserialization
33 public transient Map<String, String> headers;
34
35 public GraphQLResponse execute(String url) throws Exception {
36 Gson gson = new Gson();
37 String response = executePost(url, gson.toJson(this), this.headers);
38 return gson.fromJson(response, GraphQLResponse.class);
39 }
40
41 public GraphQLResponse executeAsGroot(String url) throws Exception {
42 if (this.headers == null) {
43 this.headers = new HashMap<>();
44 }
45 this.headers.put("X-Dgraph-AccessToken", login(GROOT_USERNAME, GROOT_PASSWORD));
46 return this.execute(url);
47 }
48 }
49
50 private static class GraphQLResponse {
51 public List<GqlError> errors;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected