Skip to content

Commit 7681d03

Browse files
authored
Remove "google-cloud-resource-prefix" header in favor of "database" url parameter in WebChannel requests. (#554)
I verified that the client still works against prod and that the ?database=... paremeter was included in every WebChannel network request. NOTE that prior to this change we were including the "google-cloud-resource-prefix" header on non-streaming RPC requests, but with this change we will not include the header or use the "database" url parameter.
1 parent 121c167 commit 7681d03

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/firestore/src/platform_browser/webchannel_connection.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ export class WebChannelConnection implements Connection {
8080
}
8181
}
8282
headers['X-Goog-Api-Client'] = X_GOOG_API_CLIENT_VALUE;
83-
// This header is used to improve routing and project isolation by the
84-
// backend.
85-
headers['google-cloud-resource-prefix'] =
86-
`projects/${this.databaseId.projectId}/` +
87-
`databases/${this.databaseId.database}`;
8883
}
8984

9085
invokeRPC<Req, Resp>(
@@ -207,6 +202,13 @@ export class WebChannelConnection implements Connection {
207202
// preflight round-trip. This is formally defined here:
208203
// https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L40
209204
httpHeadersOverwriteParam: '$httpHeaders',
205+
messageUrlParams: {
206+
// This param is used to improve routing and project isolation by the
207+
// backend and must be included in every request.
208+
database: `projects/${this.databaseId.projectId}/databases/${
209+
this.databaseId.database
210+
}`
211+
},
210212
sendRawJson: true,
211213
supportsCrossDomainXhr: true
212214
};

0 commit comments

Comments
 (0)