body is empty when parsing DELETE request with express and body-parser body is empty when parsing DELETE request with express and body-parser express express

body is empty when parsing DELETE request with express and body-parser


The $http service source code, a DELETE request using $http does not allow for data to be sent in the body of the request.

The spec for a DELETE request is somewhat vague on whether or not a request body should be allowed, but Angular does not support it.

The only methods that allow for request bodies are POST, PUT, and PATCH. So the problem is not anywhere in your code, its in Angular's $http service.

Use this

$httpProvider.defaults.headers.delete = { "Content-Type": "application/json;charset=utf-8" };

and then

$http.delete(url, { data: data })