Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8327796

Add method to java.net.http.HttpRequest to return a GET request in one call

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • core-libs
    • None

      We could avoid the following kind of common builder boilerplate

      HttpRequest request = HttpRequest.newBuilder()
         .uri(URI.create("https://foo.com/index.html"))
         .GET()
         .build();

      by adding a method to HttpRequest as follows:

          /***
           * Returns a GET HttpRequest to the given URI.
           *
           * @throws URISyntaxException if the string cannot be converted to a URI
          */
          public static HttpRequest GET(String uri) {}

            michaelm Michael McMahon
            michaelm Michael McMahon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: