JKRhb / node-red-contrib-coap

CoAP support in Node-RED
MIT License
27 stars 29 forks source link

msg.statusCode defaulting to 2.05 #86

Closed JohnnyPicnic closed 1 year ago

JohnnyPicnic commented 1 year ago

Hello, I'm finding that the msg.statusCode being sent back in a response is always 2.05 from line 173 in coap-in.js: this.on("input", function (msg, _send, done) { let code = this.options.code || msg.statusCode || "2.05";

If I remove the || "2.05" and the end I'm able to change it with my payload of msg.statusCode = "2.01". Without any modifications "2.05" was always sent no matter what I put in my msg.statusCode payload or what I put in the response node field.

JohnnyPicnic commented 1 year ago

I found the issue to be in line 168 of coap-in.js code: config.code, should be: code: config.statusCode,

JKRhb commented 1 year ago

Thank you for reporting this issue :) Do you maybe want to create a PR with your fix?

JohnnyPicnic commented 1 year ago

Sure. I've got a fork going. Are you planning on merging your request node updates? Looks like they would provide some nice features.

JKRhb commented 1 year ago

Sure. I've got a fork going.

Great! :)

Are you planning on merging your request node updates? Looks like they would provide some nice features.

Thank you for the feedback and the reminder 😅 I hope to find the time to finish the PR in the near future (i.e., this week or so), I will ping you once it is ready :)