Merge pull request #4262 from sammachin/patch-3

Handle 204 in httprequest JSON
This commit is contained in:
Nick O'Leary
2023-08-14 11:10:24 +01:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@@ -637,6 +637,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
msg.payload = msg.payload.toString('utf8'); // txt
if (node.ret === "obj") {
if (msg.statusCode == 204){msg.payload= "{}"};
try { msg.payload = JSON.parse(msg.payload); } // obj
catch(e) { node.warn(RED._("httpin.errors.json-error")); }
}