Skip to content
Permalink
Browse files
fix: Make x-goog-api-client header report rest-based transport client…
…s with `rest/` token instead of `httpson/`. (#1370)

We will still be able to disambiguate between discogapic and diregapic for compute by the `gapic/` token in the same header. Discogapic clients will be versioned as 0.x.x, while diregapics are `1.x.x-alpha`
  • Loading branch information
vam-google committed May 7, 2021
1 parent 3bae27c commit b1b0b498ba188a51b17d179988074bcf34fb7590
@@ -36,15 +36,15 @@
@InternalApi
public class GaxHttpJsonProperties {
private static final Pattern DEFAULT_API_CLIENT_HEADER_PATTERN =
Pattern.compile("gl-java/.+ gapic/.* gax/.+ httpjson/.*");
Pattern.compile("gl-java/.+ gapic/.* gax/.+ rest/.*");

/** Returns default api client header pattern (to facilitate testing) */
public static Pattern getDefaultApiClientHeaderPattern() {
return DEFAULT_API_CLIENT_HEADER_PATTERN;
}

public static String getHttpJsonTokenName() {
return "httpjson";
return "rest";
}

public static String getHttpJsonVersion() {
@@ -41,7 +41,7 @@ public class GaxHttpJsonPropertiesTest {
public void testDefaultHeaderPattern() {
assertTrue(
GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
.matcher("gl-java/1.8_00 gapic/1.2.3-alpha gax/1.5.0 httpjson/1.7.0")
.matcher("gl-java/1.8_00 gapic/1.2.3-alpha gax/1.5.0 rest/1.7.0")
.matches());
}
}

0 comments on commit b1b0b49

Please sign in to comment.