Skip to content

Commit 23d05f9

Browse files
committed
Fix
1 parent 19afe7b commit 23d05f9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/firestore/src/remote/rest_connection.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import { SDK_VERSION } from '../../src/core/version';
1919
import { Token } from '../api/credentials';
20-
import { DatabaseId, DatabaseInfo } from '../core/database_info';
20+
import {DatabaseId, DatabaseInfo, DEFAULT_DATABASE_NAME} from '../core/database_info';
2121
import { debugAssert } from '../util/assert';
2222
import { generateUniqueDebugId } from '../util/debug_uid';
2323
import { FirestoreError } from '../util/error';
@@ -85,8 +85,10 @@ export abstract class RestConnection implements Connection {
8585
const url = this.makeUrl(rpcName, path);
8686
logDebug(LOG_TAG, `Sending RPC '${rpcName}' ${streamId}:`, url, req);
8787

88-
const headers = {
89-
'x-goog-request-params': `project_id=${this.databaseId.projectId}&database_id=${this.databaseId.database}`
88+
const headers: StringMap = {
89+
'x-goog-request-params': this.databaseId.database === DEFAULT_DATABASE_NAME
90+
? `project_id=${this.databaseId.projectId}`
91+
: `project_id=${this.databaseId.projectId}&database_id=${this.databaseId.database}`
9092
};
9193
this.modifyHeadersForRequest(headers, authToken, appCheckToken);
9294

0 commit comments

Comments
 (0)