diff --git a/coap/coap-request.js b/coap/coap-request.js index 69f437b..8fb88ba 100644 --- a/coap/coap-request.js +++ b/coap/coap-request.js @@ -171,7 +171,8 @@ module.exports = function (RED) { var payload; if (reqOpts.method !== "GET") { - payload = _constructPayload(msg, reqOpts.headers["Content-Format"]); + reqOpts.headers["content-Format"] ??= config["content-format"] + payload = _constructPayload(msg, reqOpts.headers["content-Format"]); } else if (paytoqs === "query") { try { _appendQueryParams(reqOpts, msg.payload);