diff --git a/src/bucket.ts b/src/bucket.ts index f35595f82..45a9e97ca 100644 --- a/src/bucket.ts +++ b/src/bucket.ts @@ -53,7 +53,6 @@ import { PreconditionOptions, IdempotencyStrategy, BucketOptions, - ExceptionMessages, } from './storage'; import { GetSignedUrlResponse, @@ -413,7 +412,6 @@ export enum BucketExceptionMessages { PROVIDE_SOURCE_FILE = 'You must provide at least one source file.', DESTINATION_FILE_NOT_SPECIFIED = 'A destination file must be specified.', CHANNEL_ID_REQUIRED = 'An ID is required to create a channel.', - CHANNEL_ADDRESS_REQUIRED = 'An address is required to create a channel.', TOPIC_NAME_REQUIRED = 'A valid topic name is required.', CONFIGURATION_OBJECT_PREFIX_REQUIRED = 'A configuration object with a prefix is required.', SPECIFY_FILE_NAME = 'A file name must be specified.', @@ -1714,10 +1712,6 @@ class Bucket extends ServiceObject { throw new Error(BucketExceptionMessages.CHANNEL_ID_REQUIRED); } - if (typeof config.address !== 'string') { - throw new Error(BucketExceptionMessages.CHANNEL_ADDRESS_REQUIRED); - } - let options: CreateChannelOptions = {}; if (typeof optionsOrCallback === 'function') { callback = optionsOrCallback; @@ -3041,9 +3035,6 @@ class Bucket extends ServiceObject { callback?: GetSignedUrlCallback ): void | Promise { const method = BucketActionToHTTPMethod[cfg.action]; - if (!method) { - throw new Error(ExceptionMessages.INVALID_ACTION); - } const signConfig = { method, diff --git a/src/file.ts b/src/file.ts index 9c1a861ed..fa22b8600 100644 --- a/src/file.ts +++ b/src/file.ts @@ -2827,9 +2827,6 @@ class File extends ServiceObject { callback?: GetSignedUrlCallback ): void | Promise { const method = ActionToHTTPMethod[cfg.action]; - if (!method) { - throw new Error(ExceptionMessages.INVALID_ACTION); - } const extensionHeaders = objectKeyToLowercase(cfg.extensionHeaders || {}); if (cfg.action === 'resumable') { extensionHeaders['x-goog-resumable'] = 'start'; diff --git a/src/storage.ts b/src/storage.ts index ba77ee164..ce6dc1800 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -199,7 +199,6 @@ export interface GetHmacKeysCallback { export enum ExceptionMessages { EXPIRATION_DATE_INVALID = 'The expiration date provided was invalid.', EXPIRATION_DATE_PAST = 'An expiration date cannot be in the past.', - INVALID_ACTION = 'The action is not provided or invalid.', } export enum StorageExceptionMessages { diff --git a/test/bucket.ts b/test/bucket.ts index 35687b6fa..407b7c83b 100644 --- a/test/bucket.ts +++ b/test/bucket.ts @@ -49,7 +49,7 @@ import {AddAclOptions} from '../src/acl'; import {Policy} from '../src/iam'; import sinon = require('sinon'); import {Transform} from 'stream'; -import {ExceptionMessages, IdempotencyStrategy} from '../src/storage'; +import {IdempotencyStrategy} from '../src/storage'; import {convertObjKeysToSnakeCase} from '../src/util'; class FakeFile { @@ -920,12 +920,6 @@ describe('Bucket', () => { }); }); - it('should throw if an address is not provided', () => { - assert.throws(() => { - bucket.createChannel(ID, {}); - }, /An address is required to create a channel\./); - }); - it('should make the correct request', done => { const config = Object.assign({}, CONFIG, { a: 'b', @@ -2130,37 +2124,6 @@ describe('Bucket', () => { } ); }); - - it('should error if action is null', () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - SIGNED_URL_CONFIG.action = null as any; - - assert.throws(() => { - bucket.getSignedUrl(SIGNED_URL_CONFIG, () => {}), - ExceptionMessages.INVALID_ACTION; - }); - }); - - it('should error if action is undefined', () => { - const urlConfig = { - ...SIGNED_URL_CONFIG, - } as Partial; - delete urlConfig.action; - assert.throws(() => { - bucket.getSignedUrl(urlConfig, () => {}), - ExceptionMessages.INVALID_ACTION; - }); - }); - - it('should error for an invalid action', () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - SIGNED_URL_CONFIG.action = 'watch' as any; - - assert.throws(() => { - bucket.getSignedUrl(SIGNED_URL_CONFIG, () => {}), - ExceptionMessages.INVALID_ACTION; - }); - }); }); describe('lock', () => { diff --git a/test/file.ts b/test/file.ts index e2276a1a7..6b05f2efa 100644 --- a/test/file.ts +++ b/test/file.ts @@ -3549,35 +3549,6 @@ describe('File', () => { }); }); - it('should error if action is null', () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - SIGNED_URL_CONFIG.action = null as any; - - assert.throws(() => { - file.getSignedUrl(SIGNED_URL_CONFIG, () => {}), - ExceptionMessages.INVALID_ACTION; - }); - }); - - it('should error if action is undefined', () => { - const urlConfig = {...SIGNED_URL_CONFIG} as Partial; - delete urlConfig.action; - assert.throws(() => { - file.getSignedUrl(urlConfig, () => {}), - ExceptionMessages.INVALID_ACTION; - }); - }); - - it('should error for an invalid action', () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - SIGNED_URL_CONFIG.action = 'watch' as any; - - assert.throws(() => { - file.getSignedUrl(SIGNED_URL_CONFIG, () => {}), - ExceptionMessages.INVALID_ACTION; - }); - }); - it('should add "x-goog-resumable: start" header if action is resumable', done => { SIGNED_URL_CONFIG.action = 'resumable'; SIGNED_URL_CONFIG.extensionHeaders = {