Created
May 10, 2017 10:50
-
-
Save pssubashps/bf50bfc9b2a21018d52427d0ad91df44 to your computer and use it in GitHub Desktop.
post-nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function postToUrl(message) { | |
var request = require('request'); | |
var postParam = {}; | |
postParam.state = message.state; | |
postParam.input = message.input; | |
postParam.outputKeyPrefix = message.outputKeyPrefix; | |
var options = { | |
method: 'post', | |
body: postParam, // Javascript object | |
json: true, // Use,If you are sending JSON data | |
url: message.userMetadata.callbackURL, | |
headers: { | |
'Accept': 'application/json' | |
} | |
} | |
request(options, function (err, res, body) { | |
if (err) { | |
console.log('Error :', err) | |
return | |
} | |
console.log(' Body :', body) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment