From 285f30defe03f6b030b4c4555732343523c2855e Mon Sep 17 00:00:00 2001 From: Denis DelGrosso Date: Wed, 6 Oct 2021 21:48:12 +0000 Subject: [PATCH 1/2] feat: add support for useAuthWithCustomEndpoint option --- src/storage.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/storage.ts b/src/storage.ts index 9f33ab7b7..12a51b0b9 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -604,6 +604,7 @@ export class Storage extends Service { }, baseUrl, customEndpoint, + useAuthWithCustomEndpoint: options?.useAuthWithCustomEndpoint, projectIdRequired: false, scopes: [ 'https://www.googleapis.com/auth/iam', From d843d511b0bf45511c3e038c1d63368b3fb9afbe Mon Sep 17 00:00:00 2001 From: Denis DelGrosso Date: Thu, 7 Oct 2021 14:29:09 +0000 Subject: [PATCH 2/2] add test and document new option --- src/storage.ts | 1 + test/index.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/storage.ts b/src/storage.ts index 12a51b0b9..f805a59b1 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -517,6 +517,7 @@ export class Storage extends Service { * @property {number} [timeout] The amount of time in milliseconds to wait per http request before timing out. * @property {object[]} [interceptors_] Array of custom request interceptors to be returned in the order they were assigned. * @property {string} [apiEndpoint = storage.google.com] The API endpoint of the service used to make requests. + * @property {boolean} [useAuthWithCustomEndpoint] Controls whether or not to use authentication when using a custom endpoint. */ /** * Constructs the Storage client. diff --git a/test/index.ts b/test/index.ts index 17404c593..0daca2bc2 100644 --- a/test/index.ts +++ b/test/index.ts @@ -170,6 +170,20 @@ describe('Storage', () => { assert.strictEqual(calledWith.apiEndpoint, `${apiEndpoint}`); }); + it('should propagate the useAuthWithCustomEndpoint option', () => { + const useAuthWithCustomEndpoint = true; + const apiEndpoint = 'https://some.fake.endpoint'; + const storage = new Storage({ + projectId: PROJECT_ID, + useAuthWithCustomEndpoint, + apiEndpoint, + }); + const calledWith = storage.calledWith_[0]; + assert.strictEqual(calledWith.apiEndpoint, 'https://some.fake.endpoint'); + assert.strictEqual(calledWith.customEndpoint, true); + assert.strictEqual(calledWith.useAuthWithCustomEndpoint, true); + }); + it('should propagate autoRetry', () => { const autoRetry = false; const storage = new Storage({