diff --git a/src/services/open-api-client.js b/src/services/open-api-client.js index 07e0d691..af13edc1 100644 --- a/src/services/open-api-client.js +++ b/src/services/open-api-client.js @@ -61,7 +61,7 @@ class OpenApiClient { getParams(opts, operation) { const params = {}; - operation.parameters.forEach((parameter) => { + (operation.parameters || []).forEach((parameter) => { /* * Build the actual request params from the spec's query parameters. This * effectively drops all params that are not in the spec. diff --git a/test/services/twilio-api/twilio-client.test.js b/test/services/twilio-api/twilio-client.test.js index 3a6aa62e..2935ba1b 100644 --- a/test/services/twilio-api/twilio-client.test.js +++ b/test/services/twilio-api/twilio-client.test.js @@ -317,6 +317,24 @@ describe('services', () => { }); }); + describe('absent operation parameters', () => { + test + .nock('https://conversations.twilio.com', (api) => { + api.get(`/v1/Configuration`).reply(200, { + // eslint-disable-next-line camelcase + account_sid: accountSid, + }); + }) + .it('can fetch', async () => { + const response = await apiClient.fetch({ + domain: 'conversations', + path: '/v1/Configuration', + }); + + expect(response).to.eql({ accountSid }); + }); + }); + describe('regional and edge support', () => { const defaultRegionTest = test.nock('https://api.edge.us1.twilio.com', (api) => { api.post(`/2010-04-01/Accounts/${accountSid}/Messages.json`).reply(201, {