Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/google/genai/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private OkHttpClient createHttpClient(
builder.readTimeout(Duration.ofMillis(0));
builder.writeTimeout(Duration.ofMillis(0));

timeout.ifPresent(connectTimeout -> builder.connectTimeout(Duration.ofMillis(connectTimeout)));
timeout.ifPresent(callTimeout -> builder.callTimeout(Duration.ofMillis(callTimeout)));

clientOptions.ifPresent(
options -> {
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/google/genai/HttpApiClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ public void testHttpClientMLDevTimeout() throws Exception {
OkHttpClient httpClient = client.httpClient();
assertNotNull(httpClient);

assertEquals(5000, httpClient.connectTimeoutMillis());
assertEquals(5000, httpClient.callTimeoutMillis());
assertEquals(API_KEY, client.apiKey());
assertFalse(client.vertexAI());
}
Expand All @@ -920,7 +920,7 @@ public void testHttpClientVertexTimeout() throws Exception {
OkHttpClient httpClient = client.httpClient();
assertNotNull(httpClient);

assertEquals(4999, httpClient.connectTimeoutMillis());
assertEquals(4999, httpClient.callTimeoutMillis());
assertEquals(PROJECT, client.project());
assertEquals(LOCATION, client.location());
assertTrue(client.vertexAI());
Expand All @@ -934,7 +934,7 @@ public void testHttpClientNoTimeout() throws Exception {
OkHttpClient httpClient = client.httpClient();
assertNotNull(httpClient);

assertEquals(0, httpClient.connectTimeoutMillis());
assertEquals(0, httpClient.callTimeoutMillis());
assertEquals(API_KEY, client.apiKey());
assertFalse(client.httpOptions.headers().get().containsKey("X-Server-Timeout"));
}
Expand All @@ -953,7 +953,7 @@ public void testHttpClientVertexNoTimeout() throws Exception {
OkHttpClient httpClient = client.httpClient();
assertNotNull(httpClient);

assertEquals(0, httpClient.connectTimeoutMillis());
assertEquals(0, httpClient.callTimeoutMillis());
assertEquals(PROJECT, client.project());
assertEquals(LOCATION, client.location());
assertTrue(client.vertexAI());
Expand Down