From 27446ec973e102e13bf3257e602b3dd38c46d142 Mon Sep 17 00:00:00 2001 From: Sai Asish Y Date: Thu, 21 May 2026 00:53:18 -0700 Subject: [PATCH] docs: update pluggable HTTP client guide to use OkHttpGitHubConnector Fixes #2126. --- src/site/apt/index.apt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt index abae7ae2b9..3c31c5e52c 100644 --- a/src/site/apt/index.apt +++ b/src/site/apt/index.apt @@ -139,7 +139,8 @@ GitHub github = GitHubBuilder.fromEnvironment().build(); Pluggable HTTP client This library comes with a pluggable connector to use different HTTP client implementations - through <<>>. In particular, this means you can use {{{https://square.github.io/okhttp/}OkHttp}}, + through <<>>. In particular, this means you can use {{{https://square.github.io/okhttp/}OkHttp}} + via <<>> (from the <<>> package), so we can make use of its HTTP response cache. Making a conditional request against the GitHub API and receiving a 304 response {{{https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#conditional-requests}does not count against the rate limit}}. @@ -148,7 +149,8 @@ Pluggable HTTP client +-----+ Cache cache = new Cache(cacheDirectory, 10 * 1024 * 1024); // 10MB cache +OkHttpClient client = new OkHttpClient.Builder().cache(cache).build(); GitHub gitHub = GitHubBuilder.fromEnvironment() - .withConnector(new OkHttpConnector(new OkUrlFactory(new OkHttpClient().setCache(cache)))) + .withConnector(new OkHttpGitHubConnector(client)) .build(); +-----+