Check for empty dataJson

Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
This commit is contained in:
Frank Jogeleit 2022-11-03 20:24:38 +01:00
parent 6796716641
commit 6c12bc1f79

View file

@ -59,7 +59,7 @@ const request = async({ method, instanceConfig, data, files, file, actions, igno
if (instanceConfig.headers[HEADER_CONTENT_TYPE] === CONTENT_TYPE_URLENCODED) {
let dataJson = convertToJSON(data)
if (typeof dataJson === 'object') {
if (typeof dataJson === 'object' && Object.keys(dataJson).length) {
data = (new url.URLSearchParams(dataJson)).toString();
}
}