private CompletableFuture bind()

in src/main/java/com/spotify/heroic/client/HeroicClient.java [150:173]


  private CompletableFuture<Response> bind(Request request) {
    final CompletableFuture<Response> future = new CompletableFuture<>();

    client
        .newCall(request)
        .enqueue(
            new Callback() {
              @Override
              public void onFailure(Call call, IOException e) {
                future.completeExceptionally(e);
              }

              @Override
              public void onResponse(Call call, Response response) throws IOException {
                if (response.isSuccessful()) {
                  future.complete(response);
                }

                future.completeExceptionally(new HeroicServerException(response.body().string()));
              }
            });

    return future;
  }