I am trying to send Https post request using NodeJS, but getting back 'Bad request'. At the same time when I send the same request via curl everything is fine. Can you help to fix the Node code:
var options = {
host: 'api.wit.ai',
port: 443,
path: '/converse?v=20170611&session_id=125abc&q=Hi',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}
};
var req = https.request(options, function(res) {...}
The curl query: curl -XPOST 'https://api.wit.ai/converse?v=20170611&session_id=125abc&q=Hi' \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -H 'Authorization: Bearer <token>'
via Evgeny Krivosheev
No comments:
Post a Comment