I have function to call http.delete and pass a parameter flag:
function softDeleteDatasource(datasourceId,flag) {
var url = baseUrl + datasourceId;
return $http.delete(url, {'currentFieldSetFlag':flag});
}
Then I assume I can get the req.body with following code. However, I always get undefined in the console.log. I used exactly same code in http.post and it works fine when passing parameter.
var bodyParser = require('body-parser');
var jsonParser = bodyParser.json();
router.delete('/:datasourceId', jsonParser, function(req, res) {
console.log(req.body.currentFieldSetFlag);
}
I am confused why the same code can not pass parameter in http.delete? anyone know how to pass it?