code: private <T> HttpUriRequest prepareRequest(URI uri, Map<String, String> headers, String jsonData) {
          HttpUriRequest httpRequest;
          if (jsonData != null) {
              // POST data
              HttpPost httpPost = new HttpPost(uri);
              httpPost.setEntity(new StringEntity(jsonData, ContentType.APPLICATION_JSON));
              httpRequest = httpPost;
          } else {
              // GET request
              httpRequest = new HttpGet(uri);
          }
          httpRequest.addHeader(HttpHeaders.ACCEPT, "application/json");
          headers.forEach(httpRequest::addHeader);
  
          return httpRequest;
      }
docs: Prepares the HTTP request object creating a POST or GET request depending on if data
  is supplied or not.
  
  @param jsonData json POST data, will use GET if null
  @return HttpUriRequest object the prepared request