Skip to content

Commit

Permalink
fix: dont force use of watson-token as a query param
Browse files Browse the repository at this point in the history
  • Loading branch information
dpopp07 committed Nov 8, 2018
1 parent 6447f21 commit d91103f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions text-to-speech/synthesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit d91103f

Please sign in to comment.