I build nestjs project with microservices and I'm trying to send body data from HTTP method "delete" and get the data from req.body. that data is arrive empty.
nestjs project
await this.httpServiceInstance
.delete(`deleteData`, {
data,
})
microservice project
routes
app.delete("/deleteData", endpoint(deleteData));
function deleteData
module.exports = async (req) => { console.log(req.body) /* more code*/ }
it's print empty object {}
Please set $httpProvider in your config this way:
$httpProvider.defaults.headers.delete = { "Content-Type": "application/json;charset=utf-8" };
and then call delete request:
await this.httpServiceInstance
.delete(`xxxxx`, {
data,
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With