Skip to content

Commit ceed056

Browse files
authored
Began reporting client sdk information (#8271)
* Began reporting client sdk information
1 parent 01ca9df commit ceed056

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs-devsite/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ https://github.com/firebase/firebase-js-sdk
1919
| [@firebase/app](./app.md#app_package) | Firebase App |
2020
| [@firebase/app-check](./app-check.md#app-check_package) | The Firebase App Check Web SDK. |
2121
| [@firebase/auth](./auth.md#auth_package) | Firebase Authentication |
22+
| [@firebase/data-connect](./data-connect.md#data-connect_package) | Firebase Data Connect |
2223
| [@firebase/database](./database.md#database_package) | Firebase Realtime Database |
2324
| [@firebase/firestore](./firestore.md#firestore_package) | Cloud Firestore |
2425
| [@firebase/functions](./functions.md#functions_package) | Cloud Functions for Firebase |

packages/data-connect/src/network/fetch.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616
*/
1717

1818
import { Code, DataConnectError } from '../core/error';
19+
import { SDK_VERSION } from '../core/version';
1920
import { logDebug, logError } from '../logger';
2021

2122
let connectFetch: typeof fetch | null = globalThis.fetch;
2223
export function initializeFetch(fetchImpl: typeof fetch) {
2324
connectFetch = fetchImpl;
2425
}
26+
function getGoogApiClientValue(): string {
27+
return 'gl-js/ fire/' + SDK_VERSION;
28+
}
2529
export function dcFetch<T, U>(
2630
url: string,
2731
body: U,
@@ -32,7 +36,8 @@ export function dcFetch<T, U>(
3236
throw new DataConnectError(Code.OTHER, 'No Fetch Implementation detected!');
3337
}
3438
const headers: HeadersInit = {
35-
'Content-Type': 'application/json'
39+
'Content-Type': 'application/json',
40+
'X-Goog-Api-Client': getGoogApiClientValue()
3641
};
3742
if (accessToken) {
3843
headers['X-Firebase-Auth-Token'] = accessToken;

0 commit comments

Comments
 (0)