Skip to content

Commit

Permalink
fix: use storage.googleapis.com for api endpoint (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and stephenplusplus committed Sep 17, 2019
1 parent fdf70bb commit 27fa02f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ const STORAGE_DOWNLOAD_BASE_URL = 'https://storage.googleapis.com';
* @private
*/
const STORAGE_UPLOAD_BASE_URL =
'https://www.googleapis.com/upload/storage/v1/b';
'https://storage.googleapis.com/upload/storage/v1/b';

/**
* @const {RegExp}
Expand Down
4 changes: 2 additions & 2 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface StorageOptions extends GoogleAuthOptions {
promise?: typeof Promise;
/**
* The API endpoint of the service used to make requests.
* Defaults to `www.googleapis.com`.
* Defaults to `storage.googleapis.com`.
*/
apiEndpoint?: string;
}
Expand Down Expand Up @@ -372,7 +372,7 @@ export class Storage extends Service {
* @param {StorageOptions} [options] Configuration options.
*/
constructor(options: StorageOptions = {}) {
options.apiEndpoint = options.apiEndpoint || 'www.googleapis.com';
options.apiEndpoint = options.apiEndpoint || 'storage.googleapis.com';
const url =
process.env.STORAGE_EMULATOR_HOST ||
`https://${options.apiEndpoint}/storage/v1`;
Expand Down
2 changes: 1 addition & 1 deletion test/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3822,7 +3822,7 @@ describe('File', () => {
predefinedAcl: options.predefinedAcl,
},
uri:
'https://www.googleapis.com/upload/storage/v1/b/' +
'https://storage.googleapis.com/upload/storage/v1/b/' +
file.bucket.name +
'/o',
});
Expand Down
2 changes: 1 addition & 1 deletion test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('Storage', () => {

const calledWith = storage.calledWith_[0];

const baseUrl = 'https://www.googleapis.com/storage/v1';
const baseUrl = 'https://storage.googleapis.com/storage/v1';
assert.strictEqual(calledWith.baseUrl, baseUrl);
assert.strictEqual(calledWith.projectIdRequired, false);
assert.deepStrictEqual(calledWith.scopes, [
Expand Down

0 comments on commit 27fa02f

Please sign in to comment.