The following error prompts when my code executes.
It seems that body
parameter could not be read.
missing required input JSON parameter requestType.
app.post('/compare', function (req, res, next) {
var options = {
host: 'hostname',
port: 80,
path: '/service',
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': "Basic " + new Buffer(username + ":" + pass).toString("base64")
},
body: JSON.stringify({
requestType: 'createService'
})
};
var httpreq = http.request(options, function (response) {
response.on('data', function (chunk) {
console.log("body: " + chunk);
});
response.on('end', function() {
res.send('ok');
})
});
httpreq.end();
});