1
I’m making a request to make a DELETE
, and I have a problem, when I make the request, the bodyParams
is not past.
Has anyone ever had a similar problem? On the other side I’m using the express req.body
and req.query
.
Next is part of the function. The strange thing is that when making a POST
, this one works:
function request({
options,
method,
resource,
queryParams,
bodyParams,
}) {
return new Promise((resolve, reject) => {
const stringifyedQueryParams = strigifyQueryParams(queryParams);
const optionsRequest = {
...options,
method,
path: `${resource}${stringifyedQueryParams}`,
};
const req = https.request(optionsRequest, (res) => {
res.setEncoding(configs.ENCODING);
res.on(events.DATA, data => resolve({
body: data,
statusCode: res.statusCode,
}));
});
req.on(events.ERROR, error => reject(error) );
req.write(JSON.strigify(bodyParams));
req.end();
});
}
Right, but for example if you use the request plugin (https://github.com/request/request) I can send the body to delete. Cannot do this natively on Node js?
– Cláudio Hilário