Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -604,6 +605,7 @@ export class Storage extends Service {
},
baseUrl,
customEndpoint,
useAuthWithCustomEndpoint: options?.useAuthWithCustomEndpoint,
projectIdRequired: false,
scopes: [
'https://www.googleapis.com/auth/iam',
Expand Down
14 changes: 14 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down