Showing with 3 additions and 0 deletions.
  1. +2 −0 CHANGELOG.md
  2. +1 −0 ...es-client/src/main/java/io/fabric8/kubernetes/client/utils/BackwardsCompatibilityInterceptor.java
@@ -2,6 +2,8 @@

#### 4.1.1
Bugs

* Fix #1239: Fix one case of OkHttp connection leaks

Improvements

@@ -123,6 +123,7 @@ public Response intercept(Chain chain) throws IOException {
ResourceKey key = getKey(matcher);
ResourceKey target = responseCodeToTransformations.get(response.code()).get(key);
if (target != null) {
response.close(); // At this point, we know we won't reuse or return the response; so close it to avoid a connection leak.
String newUrl = new StringBuilder(url)
.replace(matcher.start(API_VERSION), matcher.end(API_VERSION), target.version) // Order matters: We need to substitute right to left, so that former substitution don't affect the indexes of later.
.replace(matcher.start(API_GROUP), matcher.end(API_GROUP), target.group)