Skip to content

Commit 5ced96d

Browse files
Merge pull request #97 from watson-developer-cloud/patch-synthesize
fix: dont force use of `watson-token` as a query param
2 parents 6447f21 + d91103f commit 5ced96d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

text-to-speech/synthesize.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ module.exports = function synthesize(options) {
4646
if (!options || (!options.token && !options.access_token)) {
4747
throw new Error('Watson TextToSpeech: missing required parameter: options.token (CF) or options.access_token (RC)');
4848
}
49-
options['watson-token'] = options.token;
50-
delete options.token;
49+
if (options.token && !options['watson-token']) {
50+
options['watson-token'] = options.token;
51+
delete options.token;
52+
}
5153
var url = options.url || 'https://stream.watsonplatform.net/text-to-speech/api';
5254
var audio = options.element || new Audio();
5355
audio.crossOrigin = 'anonymous';

0 commit comments

Comments
 (0)