The comment of HttpClient Asynchronous Example should be connectTimeout

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P5
    • None
    • Affects Version/s: 27
    • Component/s: core-libs
    • None
    • generic
    • generic

      Currently the comments for Asynchronous Example in file src/java.net.http/share/classes/java/net/http/HttpClient.java is:

       * <p><b>Asynchronous Example</b>
       * {@snippet :
       * HttpRequest request = HttpRequest.newBuilder()
       * .uri(URI.create("https://foo.com/"))
       * .timeout(Duration.ofMinutes(2))
       * .header("Content-Type", "application/json")
       * .POST(BodyPublishers.ofFile(Paths.get("file.json")))
       * .build();
       * client.sendAsync(request, BodyHandlers.ofString())
       * .thenApply(HttpResponse::body)
       * .thenAccept(System.out::println); }


      It seems that the timeout interface should be connectTimeout(Duration.ofMinutes(2)), rather than timeout(Duration.ofMinutes(2)) ?

            Assignee:
            Sendao Yan
            Reporter:
            Sendao Yan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: