Skip to content

Commit d91103f

Browse files
committed
fix: dont force use of watson-token as a query param
1 parent 6447f21 commit d91103f

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)