Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #58 from IBM-Bluemix/callbackfailed
Browse files Browse the repository at this point in the history
Watson STT now correctly set its "Accept" header to text/plain
  • Loading branch information
l2fprod authored Apr 19, 2017
2 parents 0750014 + cadb723 commit a95478e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions processing/speechtotext/speechtotext.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,18 @@ function onChallengeRequest(challenge, secret, signature) {
console.log('[OK] Challenge accepted!');
return {
headers: {
// force Content-Type as JSON as Watson sends an Accept: application/json
'Content-Type': 'application/json'
'Content-Type': 'text/plain'
},
// but sends the body as raw data as Watson expects plain text
body: new Buffer(challenge).toString('base64')
body: challenge
};
}

console.log('[KO] Signature does not match');
return {
code: 500,
headers: {
'Content-Type': 'text/plain'
},
body: 'Bad signature'
};
}
Expand Down

0 comments on commit a95478e

Please sign in to comment.