Repository: googleapis/google-api-java-client
Pull request #2453 (2024-03-18 09:59:24)

chore(deps): update dependency org.apache.maven.plugins:maven-gpg-plugin to v3.2.4
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.apache.maven.plugins:maven-gpg-plugin](https://maven.apache.org/plugins/) | `3.2.0` -> `3.2.4` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.apache.maven.plugins:maven-gpg-plugin/3.2.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.apache.maven.plugins:maven-gpg-plugin/3.2.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.apache.maven.plugins:maven-gpg-plugin/3.2.0/3.2.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.apache.maven.plugins:maven-gpg-plugin/3.2.0/3.2.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/googleapis/google-api-java-client).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNDUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjMwMS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->



Patch:
diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index dc05a727..5db36a5f 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -13,5 +13,5 @@
 # limitations under the License.
 docker:
   image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
-  digest: sha256:a6aa751984f1e905c3ae5a3aac78fc7b68210626ce91487dc7ff4f0a06f010cc
-# created: 2024-01-22T14:14:20.913785597Z
+  digest: sha256:68ba5f5164a4b55529d358bb262feaa000536a0c62980727dd05a91bbb47ea5e
+# created: 2024-05-09T16:31:37.168667071Z
diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml
index f5fc7d51..59f00b8e 100644
--- a/.github/workflows/approve-readme.yaml
+++ b/.github/workflows/approve-readme.yaml
@@ -21,7 +21,7 @@ jobs:
     runs-on: ubuntu-latest
     if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme'
     steps:
-      - uses: actions/github-script@v6
+      - uses: actions/github-script@v7
         with:
           github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
           script: |
diff --git a/.github/workflows/renovate_config_check.yaml b/.github/workflows/renovate_config_check.yaml
index 87d8eb2b..7c5ec786 100644
--- a/.github/workflows/renovate_config_check.yaml
+++ b/.github/workflows/renovate_config_check.yaml
@@ -14,7 +14,7 @@ jobs:
       uses: actions/checkout@v4
 
     - name: Set up Node.js
-      uses: actions/setup-node@v3
+      uses: actions/setup-node@v4
       with:
         node-version: '20'
 
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d88f74fa..c46e5ade 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
 # Changelog
 
+## [2.4.1](https://github.com/googleapis/google-api-java-client/compare/v2.4.0...v2.4.1) (2024-03-26)
+
+
+### Documentation
+
+* Latest libraries-bom ([#2445](https://github.com/googleapis/google-api-java-client/issues/2445)) ([b484c9b](https://github.com/googleapis/google-api-java-client/commit/b484c9b41ab226e9759c6a71c528158195468ec9))
+
 ## [2.4.0](https://github.com/googleapis/google-api-java-client/compare/v2.3.0...v2.4.0) (2024-03-13)
 
 
diff --git a/google-api-client-android/pom.xml b/google-api-client-android/pom.xml
index 3609714b..d65b967e 100644
--- a/google-api-client-android/pom.xml
+++ b/google-api-client-android/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-android</artifactId>
diff --git a/google-api-client-appengine/pom.xml b/google-api-client-appengine/pom.xml
index 28067a0f..f22f651b 100644
--- a/google-api-client-appengine/pom.xml
+++ b/google-api-client-appengine/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-appengine</artifactId>
diff --git a/google-api-client-assembly/pom.xml b/google-api-client-assembly/pom.xml
index 270e9ce9..66c33be0 100644
--- a/google-api-client-assembly/pom.xml
+++ b/google-api-client-assembly/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <groupId>com.google.api-client</groupId>
diff --git a/google-api-client-bom/pom.xml b/google-api-client-bom/pom.xml
index 1e4c93c7..6632381e 100644
--- a/google-api-client-bom/pom.xml
+++ b/google-api-client-bom/pom.xml
@@ -3,7 +3,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.google.api-client</groupId>
   <artifactId>google-api-client-bom</artifactId>
-  <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+  <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
   <packaging>pom</packaging>
 
   <name>Google API Client Library for Java BOM</name>
@@ -63,48 +63,48 @@
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-android</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-appengine</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-assembly</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
         <type>pom</type>
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-gson</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-jackson2</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-protobuf</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-servlet</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-xml</artifactId>
-        <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
     </dependencies>
   </dependencyManagement>
@@ -170,7 +170,7 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-gpg-plugin</artifactId>
-            <version>3.2.0</version>
+            <version>3.2.4</version>
             <executions>
               <execution>
                 <id>sign-artifacts</id>
diff --git a/google-api-client-gson/pom.xml b/google-api-client-gson/pom.xml
index 1089867b..7937f3c5 100644
--- a/google-api-client-gson/pom.xml
+++ b/google-api-client-gson/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-gson</artifactId>
diff --git a/google-api-client-jackson2/pom.xml b/google-api-client-jackson2/pom.xml
index 190fb2ac..f61e4878 100644
--- a/google-api-client-jackson2/pom.xml
+++ b/google-api-client-jackson2/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-jackson2</artifactId>
diff --git a/google-api-client-protobuf/pom.xml b/google-api-client-protobuf/pom.xml
index bc9fb496..cd4a47c0 100644
--- a/google-api-client-protobuf/pom.xml
+++ b/google-api-client-protobuf/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-protobuf</artifactId>
diff --git a/google-api-client-servlet/pom.xml b/google-api-client-servlet/pom.xml
index 98547c6b..65146225 100644
--- a/google-api-client-servlet/pom.xml
+++ b/google-api-client-servlet/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-servlet</artifactId>
diff --git a/google-api-client-xml/pom.xml b/google-api-client-xml/pom.xml
index 8858028b..4eb0a252 100644
--- a/google-api-client-xml/pom.xml
+++ b/google-api-client-xml/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-xml</artifactId>
diff --git a/google-api-client/pom.xml b/google-api-client/pom.xml
index 993c27d1..ac041db8 100644
--- a/google-api-client/pom.xml
+++ b/google-api-client/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client</artifactId>
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java b/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
index cd6d12b6..f729375f 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
@@ -37,6 +37,7 @@ import com.google.api.client.http.HttpResponseInterceptor;
 import com.google.api.client.http.UriTemplate;
 import com.google.api.client.util.GenericData;
 import com.google.api.client.util.Preconditions;
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Joiner;
 import java.io.IOException;
 import java.io.InputStream;
@@ -62,7 +63,13 @@ public abstract class AbstractGoogleClientRequest<T> extends GenericData {
    */
   public static final String USER_AGENT_SUFFIX = "Google-API-Java-Client";
 
-  private static final String API_VERSION_HEADER = "X-Goog-Api-Client";
+  private static final String API_CLIENT_HEADER = "X-Goog-Api-Client";
+
+  /**
+   * The generated request class will pass this constant as part of the header if the RPC supports
+   * ApiVersion.
+   */
+  protected static final String API_VERSION_HEADER = "X-Google-Api-Version";
 
   /** Google client. */
   private final AbstractGoogleClient abstractGoogleClient;
@@ -133,7 +140,7 @@ public abstract class AbstractGoogleClientRequest<T> extends GenericData {
       requestHeaders.setUserAgent(USER_AGENT_SUFFIX + "/" + GoogleUtils.VERSION);
     }
     // Set the header for the Api Client version (Java and OS version)
-    requestHeaders.set(API_VERSION_HEADER, ApiClientVersion.DEFAULT_VERSION);
+    requestHeaders.set(API_CLIENT_HEADER, ApiClientVersion.DEFAULT_VERSION);
   }
 
   /**
@@ -312,6 +319,12 @@ public abstract class AbstractGoogleClientRequest<T> extends GenericData {
     return this;
   }
 
+  /** Returns the ApiVersion set in the headers. If ApiVersion is not set, null is returned. */
+  @VisibleForTesting
+  String getApiVersionHeader() {
+    return (String) requestHeaders.get(API_VERSION_HEADER);
+  }
+
   /**
    * Returns the HTTP headers of the last response or {@code null} before request has been executed.
    */
diff --git a/pom.xml b/pom.xml
index 878ed12d..5e89828b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.google.api-client</groupId>
   <artifactId>google-api-client-parent</artifactId>
-  <version>2.4.1-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+  <version>2.4.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
   <packaging>pom</packaging>
   <name>Parent for the Google API Client Library for Java</name>
   <description>The Google APIs Client Library for Java is a Java client library
@@ -517,7 +517,7 @@
     <project.jsr305.version>3.0.2</project.jsr305.version>
     <project.gson.version>2.8.6</project.gson.version>
     <project.protobuf-java.version>3.25.3</project.protobuf-java.version>
-    <project.guava.version>33.0.0-jre</project.guava.version>
+    <project.guava.version>33.2.0-jre</project.guava.version>
     <project.appengine.version>2.0.25</project.appengine.version>
     <project.xpp3.version>1.1.4c</project.xpp3.version>
     <project.jdo2-api.version>2.3-20090302111651</project.jdo2-api.version>
@@ -543,7 +543,7 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-gpg-plugin</artifactId>
-            <version>3.2.0</version>
+            <version>3.2.4</version>
             <executions>
               <execution>
                 <id>sign-artifacts</id>
diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml
index 69008cc8..d1a3df82 100644
--- a/samples/install-without-bom/pom.xml
+++ b/samples/install-without-bom/pom.xml
@@ -29,7 +29,7 @@
     <dependency>
       <groupId>com.google.api-client</groupId>
       <artifactId>google-api-client</artifactId>
-      <version>2.3.0</version>
+      <version>2.4.1</version>
     </dependency>
     <!-- [END google-api-client_install_without_bom] -->
 
diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml
index ba42d268..388775f5 100644
--- a/samples/snapshot/pom.xml
+++ b/samples/snapshot/pom.xml
@@ -28,7 +28,7 @@
     <dependency>
       <groupId>com.google.api-client</groupId>
       <artifactId>google-api-client</artifactId>
-      <version>2.3.0</version>
+      <version>2.4.1</version>
     </dependency>
   <!-- {x-version-update-end} -->
 
diff --git a/versions.txt b/versions.txt
index 47f9818e..d7974c74 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,4 +1,4 @@
 # Format:
 # module:released-version:current-version
 
-google-api-client:2.4.0:2.4.1-SNAPSHOT
+google-api-client:2.4.1:2.4.2-SNAPSHOT


Test patch:
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/MockGoogleClientRequest.java b/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/MockGoogleClientRequest.java
index c1cf32cc..b3b0ad4d 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/MockGoogleClientRequest.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/testing/services/MockGoogleClientRequest.java
@@ -18,6 +18,7 @@ import com.google.api.client.http.HttpContent;
 import com.google.api.client.http.HttpHeaders;
 import com.google.api.client.http.UriTemplate;
 import com.google.api.client.util.Beta;
+import com.google.common.base.Strings;
 
 /**
  * {@link Beta} <br>
@@ -46,7 +47,32 @@ public class MockGoogleClientRequest<T> extends AbstractGoogleClientRequest<T> {
       String uriTemplate,
       HttpContent content,
       Class<T> responseClass) {
+    this(client, method, uriTemplate, content, responseClass, null);
+  }
+
+  /**
+   * @param client Google client
+   * @param method HTTP Method
+   * @param uriTemplate URI template for the path relative to the base URL. If it starts with a "/"
+   *     the base path from the base URL will be stripped out. The URI template can also be a full
+   *     URL. URI template expansion is done using {@link UriTemplate#expand(String, String, Object,
+   *     boolean)}
+   * @param content HTTP content or {@code null} for none
+   * @param responseClass response class to parse into
+   * @param apiVersion ApiVersion to be passed to the header
+   */
+  public MockGoogleClientRequest(
+      AbstractGoogleClient client,
+      String method,
+      String uriTemplate,
+      HttpContent content,
+      Class<T> responseClass,
+      String apiVersion) {
     super(client, method, uriTemplate, content, responseClass);
+    // Matches generator code: Null or Empty String is not set to the header
+    if (!Strings.isNullOrEmpty(apiVersion)) {
+      getRequestHeaders().set(API_VERSION_HEADER, apiVersion);
+    }
   }
 
   @Override
diff --git a/google-api-client/src/test/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequestTest.java b/google-api-client/src/test/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequestTest.java
index 1eefdb13..79e156b3 100644
--- a/google-api-client/src/test/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequestTest.java
+++ b/google-api-client/src/test/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequestTest.java
@@ -242,6 +242,49 @@ public class AbstractGoogleClientRequestTest extends TestCase {
     request.executeUnparsed();
   }
 
+  public void testSetsApiVersionHeader_apiVersionSet() {
+    String apiVersion = "testVersion";
+    HttpTransport transport = new MockHttpTransport();
+    MockGoogleClient client =
+        new MockGoogleClient.Builder(transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null)
+            .build();
+    AbstractGoogleClientRequest<Void> request =
+        new MockGoogleClientRequest<>(
+            client, HttpMethods.GET, URI_TEMPLATE, null, Void.class, apiVersion);
+    assertEquals(apiVersion, request.getApiVersionHeader());
+  }
+
+  public void testDoesNotSetsApiVersionHeader_noApiVersionSet() {
+    HttpTransport transport = new MockHttpTransport();
+    MockGoogleClient client =
+        new MockGoogleClient.Builder(transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null)
+            .build();
+    AbstractGoogleClientRequest<Void> request =
+        new MockGoogleClientRequest<>(client, HttpMethods.GET, URI_TEMPLATE, null, Void.class);
+    assertNull(request.getApiVersionHeader());
+  }
+
+  public void testNullApiVersionHeader_noApiVersionSet() {
+    HttpTransport transport = new MockHttpTransport();
+    MockGoogleClient client =
+        new MockGoogleClient.Builder(transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null)
+            .build();
+    final AbstractGoogleClientRequest<Void> request =
+        new MockGoogleClientRequest<>(
+            client, HttpMethods.GET, URI_TEMPLATE, null, Void.class, null);
+    assertNull(request.getApiVersionHeader());
+  }
+
+  public void testEmptyStringApiVersionHeader_noApiVersionSet() {
+    HttpTransport transport = new MockHttpTransport();
+    MockGoogleClient client =
+        new MockGoogleClient.Builder(transport, ROOT_URL, SERVICE_PATH, JSON_OBJECT_PARSER, null)
+            .build();
+    final AbstractGoogleClientRequest<Void> request =
+        new MockGoogleClientRequest<>(client, HttpMethods.GET, URI_TEMPLATE, null, Void.class, "");
+    assertNull(request.getApiVersionHeader());
+  }
+
   public void testSetsApiClientHeader() throws IOException {
     HttpTransport transport =
         new AssertHeaderTransport("X-Goog-Api-Client", "gl-java/\\d+\\.\\d+\\.\\d+.*");