I have a function to call http.delete and pass the parameter flag:
function softDeleteDatasource(datasourceId,flag) { var url = baseUrl + datasourceId; return $http.delete(url, {'currentFieldSetFlag':flag}); }
Then I guess I can get req.body with the following code. However, I always get undefined in console.log . I used the exact same code in http.post and it works great when passing a 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 cannot pass the parameter to http.delete ? Does anyone know how to pass it?
source share