diff --git a/src/storage.ts b/src/storage.ts index 9f33ab7b7..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. @@ -604,6 +605,7 @@ export class Storage extends Service { }, baseUrl, customEndpoint, + useAuthWithCustomEndpoint: options?.useAuthWithCustomEndpoint, projectIdRequired: false, scopes: [ 'https://www.googleapis.com/auth/iam', 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({