I am making a request to make a DELETE
, and I have a problem, when ordering, bodyParams
is not passed.
Has anyone ever had a similar problem? On the other hand I'm using the expression req.body
and req.query
.
Next is part of the function. The strange thing is that by doing POST
, it 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();
});
}