From 78785a28f030456ba2a8e73ffd44f65ecca51601 Mon Sep 17 00:00:00 2001 From: Michael Lehenbauer Date: Wed, 7 Mar 2018 13:42:58 -0800 Subject: [PATCH] Remove "google-cloud-resource-prefix" header in favor of "database" url parameter in WebChannel requests. 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. --- .../src/platform_browser/webchannel_connection.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/firestore/src/platform_browser/webchannel_connection.ts b/packages/firestore/src/platform_browser/webchannel_connection.ts index 398cc2ac729..dc676c0ce42 100644 --- a/packages/firestore/src/platform_browser/webchannel_connection.ts +++ b/packages/firestore/src/platform_browser/webchannel_connection.ts @@ -80,11 +80,6 @@ export class WebChannelConnection implements Connection { } } headers['X-Goog-Api-Client'] = X_GOOG_API_CLIENT_VALUE; - // This header is used to improve routing and project isolation by the - // backend. - headers['google-cloud-resource-prefix'] = - `projects/${this.databaseId.projectId}/` + - `databases/${this.databaseId.database}`; } invokeRPC( @@ -207,6 +202,13 @@ export class WebChannelConnection implements Connection { // preflight round-trip. This is formally defined here: // https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L40 httpHeadersOverwriteParam: '$httpHeaders', + messageUrlParams: { + // This param is used to improve routing and project isolation by the + // backend and must be included in every request. + database: `projects/${this.databaseId.projectId}/databases/${ + this.databaseId.database + }` + }, sendRawJson: true, supportsCrossDomainXhr: true };