logoalt Hacker News

lenkitetoday at 1:04 PM1 replyview on HN

Your http client setup is over-complicated. You certainly don't need `.proxy` if you are not using a proxy or if you are using the system default proxy, nor do you need `.authenticator` if you are not doing HTTP authentication. Nor do you need `version` since there is already a fallback to HTTP/1.1.

  HttpClient client = HttpClient.newBuilder()
    .followRedirects(Redirect.NORMAL)
    .connectTimeout(Duration.ofSeconds(20))
    .build();

Replies

ffsm8today at 1:09 PM

It was literally just copy pasted from the linked source (the official Oracle docs)

show 1 reply