Skip to content

Commit

Permalink
Merge pull request #97 from watson-developer-cloud/patch-synthesize
Browse files Browse the repository at this point in the history
fix: dont force use of `watson-token` as a query param
  • Loading branch information
germanattanasio authored Nov 8, 2018
2 parents 6447f21 + d91103f commit 5ced96d
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 5ced96d

Please sign in to comment.