Skip to content

Commit 7f37433

Browse files
stephenpluspluscallmehiphop
authored andcommitted
datastore: provide google-cloud-resource-prefix header (#1558)
1 parent e413ed4 commit 7f37433

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/datastore/src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,10 @@ function Datastore(options) {
325325
service: 'datastore',
326326
apiVersion: 'v1',
327327
scopes: ['https://www.googleapis.com/auth/datastore'],
328-
userAgent: PKG.name + '/' + PKG.version
328+
userAgent: PKG.name + '/' + PKG.version,
329+
grpcMetadata: {
330+
'google-cloud-resource-prefix': 'projects/' + this.projectId
331+
}
329332
};
330333

331334
common.GrpcService.call(this, config, options);

packages/datastore/test/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ describe('Datastore', function() {
158158
'https://www.googleapis.com/auth/datastore'
159159
]);
160160
assert.strictEqual(calledWith.userAgent, PKG.name + '/' + PKG.version);
161+
assert.deepEqual(calledWith.grpcMetadata, {
162+
'google-cloud-resource-prefix': 'projects/' + datastore.projectId
163+
});
161164
});
162165
});
163166

0 commit comments

Comments
 (0)