CCCPaste

b60343e313884

 public void get(WebClient client) {
        client
                .post(8181, "localhost", "/graphql")
                .putHeader("Content-Type", "application/json")
                .sendJsonObject(
                        new JsonObject()
                                .put("query", "{Book { uuid, book_name, author }}")
                )
                .onSuccess(res -> {
                    if (res.statusCode() == 200 &&
                            res.getHeader("content-type").equals("application/json;charset=utf-8")) {
                        JsonObject body = res.bodyAsJsonObject();
                        post(client, body);
                    }
                });
    }

    public void post(WebClient client, JsonObject body) {
        client
                .post(8181, "localhost", "/http")
                .putHeader("Content-Type", "application/json")
                .putHeader("auth-token", "9f226286-e0d8-4125-ad43-b123b4e464da")
                .sendJsonObject(body)
                .onSuccess(res -> {
                    //todo
                });
    }