From d91103ff39ac0462bbfb80df90c3459f42d9fd19 Mon Sep 17 00:00:00 2001 From: Dustin Popp Date: Thu, 8 Nov 2018 10:12:35 -0600 Subject: [PATCH] fix: dont force use of `watson-token` as a query param --- text-to-speech/synthesize.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/text-to-speech/synthesize.js b/text-to-speech/synthesize.js index 59123d2b..73d12c98 100644 --- a/text-to-speech/synthesize.js +++ b/text-to-speech/synthesize.js @@ -46,8 +46,10 @@ module.exports = function synthesize(options) { if (!options || (!options.token && !options.access_token)) { throw new Error('Watson TextToSpeech: missing required parameter: options.token (CF) or options.access_token (RC)'); } - options['watson-token'] = options.token; - delete options.token; + if (options.token && !options['watson-token']) { + options['watson-token'] = options.token; + delete options.token; + } var url = options.url || 'https://stream.watsonplatform.net/text-to-speech/api'; var audio = options.element || new Audio(); audio.crossOrigin = 'anonymous';