1
0
Fork 0
mirror of https://github.com/fjogeleit/http-request-action.git synced 2024-12-23 04:37:28 +00:00

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) { if (instanceConfig.headers[HEADER_CONTENT_TYPE] === CONTENT_TYPE_URLENCODED) {
let dataJson = convertToJSON(data) let dataJson = convertToJSON(data)
if (typeof dataJson === 'object') { if (typeof dataJson === 'object' && Object.keys(dataJson).length) {
data = (new url.URLSearchParams(dataJson)).toString(); data = (new url.URLSearchParams(dataJson)).toString();
} }
} }