code: private void sendRequestInternal(String rootUrl, String path, RequestOptions options) throws IOException, JSONException {
          logger.debug("Sending request to root: " + rootUrl + " with path: " + path);
  
          // create default options object with GET request method.
          if (options == null) {
              options = new RequestOptions();
          }
  
          // used to resend request
          this.requestPath = Utils.concatenateUrls(rootUrl, path);
          this.requestOptions = options;
  
          AuthorizationRequest request = new AuthorizationRequest(this.requestPath, options.requestMethod);
  
          if (options.timeout != 0) {
              request.setTimeout(options.timeout);
          } else {
              request.setTimeout(BMSClient.getInstance().getDefaultTimeout());
          }
  
          if (options.headers != null) {
              for (Map.Entry<String, String> entry : options.headers.entrySet()) {
                  request.addHeader(entry.getKey(), entry.getValue());
              }
          }
  
          if (answers != null) {
              // 0 means no spaces in the generated string
              String answer = answers.toString(0);
  
              String authorizationHeaderValue = String.format("Bearer %s", answer.replace("\n", ""));
              request.addHeader("Authorization", authorizationHeaderValue);
              logger.debug("Added authorization header to request: " + authorizationHeaderValue);
          }
  
          if (Request.GET.equalsIgnoreCase(options.requestMethod)) {
              request.setQueryParameters(options.parameters);
              request.send(this);
          } else {
              request.send(options.parameters, this);
          }
      }
docs: Builds an authorization request and sends it. It also caches the request url and request options in
  order to be able to re-send the request when authorization challenges have been handled.
  
  @param rootUrl Root of authorization server.
  @param path    Path to authorization endpoint.
  @param options BaseRequest options.
  @throws IOException
  @throws JSONException