code: protected void sendRequest(HttpURLConnection connection, Request request) throws IOException {
          // Set up the request.
          connection.setRequestMethod(request.method);
          connection.setRequestProperty("Accept", "application/json");
          connection.setRequestProperty("Authorization", request.authorization);
  
          // If a different HttpHandler is used, we won't get this header. We would need to refactor
          // to a delegation pattern to give the client code's HttpHandler a chance to process the
          // Request first, then attach our custom headers, which would likely be a breaking change.
          connection.setRequestProperty("Keen-Sdk", "java-" + KeenVersion.getSdkVersion());
  
          // If the request has a body, send it. Otherwise just connect.
          if (request.body != null) {
              if (HttpMethods.GET.equals(request.method) ||
                  HttpMethods.DELETE.equals(request.method)) {
                  throw new IllegalStateException("Trying to send a GET request with a request " +
                                                  "body, which would result in sending a POST.");
              }
  
              connection.setDoOutput(true);
              connection.setRequestProperty("Content-Type", "application/json");
              request.body.writeTo(connection.getOutputStream());
          } else {
              connection.connect();
          }
      }
docs: Sends a request over a given connection.
  
  @param connection The connection over which to send the request.
  @param request The request to send.
  @throws IOException If there is an error sending the request.