diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 184daf1c..ac675f1c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,6 +17,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/increase-kotlin' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
@@ -39,6 +40,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/increase-kotlin' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 7f41457d..4dd46f13 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.244.1"
+ ".": "0.244.2"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 24671332..10710663 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 201
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-a027ea8bf72e85055306ceaf380c0311b8ed5e6e83962de0ccf48f62c85403fc.yml
-openapi_spec_hash: 5a69ed697dee32af7deae0c6ebf27377
+openapi_spec_hash: 4e35ead65a06ac0783945b2b213ce83c
config_hash: 97774f946585cecb19181a1817870d0b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 189a7269..a3f38f29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## 0.244.2 (2025-06-29)
+
+Full Changelog: [v0.244.1...v0.244.2](https://github.com/Increase/increase-kotlin/compare/v0.244.1...v0.244.2)
+
+### Bug Fixes
+
+* **client:** don't close client on `withOptions` usage when original is gc'd ([1e698b7](https://github.com/Increase/increase-kotlin/commit/1e698b774c046087907252b149a28248bcbb57e9))
+
+
+### Chores
+
+* **ci:** only run for pushes and fork pull requests ([01c32e5](https://github.com/Increase/increase-kotlin/commit/01c32e5b1a1e65cebe7268f0ac3b4d6fa24b600b))
+
## 0.244.1 (2025-06-26)
Full Changelog: [v0.244.0...v0.244.1](https://github.com/Increase/increase-kotlin/compare/v0.244.0...v0.244.1)
diff --git a/README.md b/README.md
index f3784d24..164a3987 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.increase.api/increase-kotlin/0.244.1)
-[](https://javadoc.io/doc/com.increase.api/increase-kotlin/0.244.1)
+[](https://central.sonatype.com/artifact/com.increase.api/increase-kotlin/0.244.2)
+[](https://javadoc.io/doc/com.increase.api/increase-kotlin/0.244.2)
@@ -13,7 +13,7 @@ The Increase Kotlin SDK is similar to the Increase Java SDK but with minor diffe
-The REST API documentation can be found on [increase.com](https://increase.com/documentation). KDocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-kotlin/0.244.1).
+The REST API documentation can be found on [increase.com](https://increase.com/documentation). KDocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-kotlin/0.244.2).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d
### Gradle
```kotlin
-implementation("com.increase.api:increase-kotlin:0.244.1")
+implementation("com.increase.api:increase-kotlin:0.244.2")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.increase.api:increase-kotlin:0.244.1")
com.increase.api
increase-kotlin
- 0.244.1
+ 0.244.2
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 2142ff5b..0606717d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.increase.api"
- version = "0.244.1" // x-release-please-version
+ version = "0.244.2" // x-release-please-version
}
subprojects {
diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
index 2b0a6231..785b54b4 100644
--- a/increase-kotlin-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
+++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
@@ -88,7 +88,9 @@ private constructor(
webhookSecret = clientOptions.webhookSecret
}
- fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
+ fun httpClient(httpClient: HttpClient) = apply {
+ this.httpClient = PhantomReachableClosingHttpClient(httpClient)
+ }
fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply {
this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility
@@ -234,14 +236,12 @@ private constructor(
return ClientOptions(
httpClient,
- PhantomReachableClosingHttpClient(
- RetryingHttpClient.builder()
- .httpClient(httpClient)
- .clock(clock)
- .maxRetries(maxRetries)
- .idempotencyHeader("Idempotency-Key")
- .build()
- ),
+ RetryingHttpClient.builder()
+ .httpClient(httpClient)
+ .clock(clock)
+ .maxRetries(maxRetries)
+ .idempotencyHeader("Idempotency-Key")
+ .build(),
checkJacksonVersionCompatibility,
jsonMapper,
clock,
diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/core/ClientOptionsTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/core/ClientOptionsTest.kt
new file mode 100644
index 00000000..2d4ce6f6
--- /dev/null
+++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/core/ClientOptionsTest.kt
@@ -0,0 +1,33 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.core
+
+import com.increase.api.core.http.HttpClient
+import org.assertj.core.api.Assertions.assertThat
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+import org.mockito.junit.jupiter.MockitoExtension
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.never
+import org.mockito.kotlin.verify
+
+@ExtendWith(MockitoExtension::class)
+internal class ClientOptionsTest {
+
+ @Test
+ fun toBuilder_whenOriginalClientOptionsGarbageCollected_doesNotCloseOriginalClient() {
+ val httpClient = mock()
+ var clientOptions =
+ ClientOptions.builder().httpClient(httpClient).apiKey("My API Key").build()
+ verify(httpClient, never()).close()
+
+ // Overwrite the `clientOptions` variable so that the original `ClientOptions` is GC'd.
+ clientOptions = clientOptions.toBuilder().build()
+ System.gc()
+ Thread.sleep(100)
+
+ verify(httpClient, never()).close()
+ // This exists so that `clientOptions` is still reachable.
+ assertThat(clientOptions).isEqualTo(clientOptions)
+ }
+}