Skip to content

Commit 2d9acc3

Browse files
sararobcopybara-github
authored andcommitted
chore: Append language to user-agent header
FUTURE_COPYBARA_INTEGRATE_REVIEW=#596 from googleapis:release-please--branches--main--components--vertexai 489440d PiperOrigin-RevId: 900425828
1 parent 73d18da commit 2d9acc3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/genai/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export class Client {
3535
vertexai: true,
3636
httpOptions: options.apiEndpoint ? {baseUrl: options.apiEndpoint} :
3737
undefined,
38-
userAgentExtra: `vertex-genai-modules/${SDK_VERSION}`,
38+
userAgentExtra:
39+
`vertex-genai-modules/${SDK_VERSION}`, // gl-node/${process.version}
3940
});
4041

4142
this._agentEnginesInternal = new AgentEngines(this.apiClient);

test/genai/_replay_client.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ export class ReplayClient extends Client {
8686
}
8787

8888
const [url, init] = actualArgs;
89+
90+
91+
const actualHeaders = new Headers(init?.headers || {});
92+
const xGoogApiClient = actualHeaders.get('x-goog-api-client') || '';
93+
const userAgent = actualHeaders.get('user-agent') || '';
94+
95+
// Validate that the required identifiers are present
96+
expect(xGoogApiClient).toContain('vertex-genai-modules/');
97+
expect(xGoogApiClient).toContain('gl-node/');
98+
expect(userAgent).toContain('vertex-genai-modules/');
99+
expect(userAgent).toContain('gl-node/');
100+
89101
const normalizedActual = normalizeRequest(init || {}, url.toString());
90102
assertMessagesEqual(normalizedActual, expectedRequestCamel);
91103
}

0 commit comments

Comments
 (0)