Skip to content

Commit 76f635a

Browse files
committed
Send app ID if automaticDataCollectionEnabled is falsy.
1 parent 767cd77 commit 76f635a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/vertexai/src/requests/request.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ describe('request methods', () => {
126126
const headers = await getHeaders(fakeUrl);
127127
expect(headers.get('x-goog-api-key')).to.equal('key');
128128
});
129-
it('adds app id if automatedDataCollectionEnabled is undefined', async () => {
130-
const headers = await getHeaders(fakeUrl);
131-
expect(headers.get('X-Firebase-AppId')).to.equal('my-appid');
132-
});
133129
it('adds app id if automatedDataCollectionEnabled is true', async () => {
134130
const fakeApiSettings: ApiSettings = {
135131
apiKey: 'key',
@@ -148,7 +144,11 @@ describe('request methods', () => {
148144
{}
149145
);
150146
const headers = await getHeaders(fakeUrl);
151-
expect(headers.get('X-Firebase-AppId')).to.equal('my-appid');
147+
expect(headers.get('X-Firebase-Appid')).to.equal('my-appid');
148+
});
149+
it('does not add app id if automatedDataCollectionEnabled is undefined', async () => {
150+
const headers = await getHeaders(fakeUrl);
151+
expect(headers.get('X-Firebase-Appid')).to.be.null;
152152
});
153153
it('does not add app id if automatedDataCollectionEnabled is false', async () => {
154154
const fakeApiSettings: ApiSettings = {
@@ -168,7 +168,7 @@ describe('request methods', () => {
168168
{}
169169
);
170170
const headers = await getHeaders(fakeUrl);
171-
expect(headers.get('X-Firebase-AppId')).to.be.null;
171+
expect(headers.get('X-Firebase-Appid')).to.be.null;
172172
});
173173
it('adds app check token if it exists', async () => {
174174
const headers = await getHeaders(fakeUrl);

packages/vertexai/src/requests/request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export async function getHeaders(url: RequestUrl): Promise<Headers> {
8484
headers.append('Content-Type', 'application/json');
8585
headers.append('x-goog-api-client', getClientHeaders());
8686
headers.append('x-goog-api-key', url.apiSettings.apiKey);
87-
if (url.apiSettings.automaticDataCollectionEnabled !== false) {
88-
headers.append('X-Firebase-AppId', url.apiSettings.appId);
87+
if (url.apiSettings.automaticDataCollectionEnabled) {
88+
headers.append('X-Firebase-Appid', url.apiSettings.appId);
8989
}
9090
if (url.apiSettings.getAppCheckToken) {
9191
const appCheckToken = await url.apiSettings.getAppCheckToken();

0 commit comments

Comments
 (0)