code: private static HttpUriRequest createHttpUriRequest(String method, URI uri) {
          switch (method) {
              case "GET":
                  return new HttpGet(uri);
              case "HEAD":
                  return new HttpHead(uri);
              case "POST":
                  return new HttpPost(uri);
              case "PUT":
                  return new HttpPut(uri);
              case "PATCH":
                  return new HttpPatch(uri);
              case "DELETE":
                  return new HttpDelete(uri);
              case "OPTIONS":
                  return new HttpOptions(uri);
              case "TRACE":
                  return new HttpTrace(uri);
              default:
                  throw new IllegalArgumentException("Invalid HTTP method: " + method);
          }
      }
docs: Create a Commons HttpMethodBase object for the given HTTP method and URI specification.
  @param method the HTTP method
  @param uri the URI
  @return the Commons HttpMethodBase object