I'm using node-coap (https://github.com/mcollina/node-coap) to send Coap packets, now I'm trying to do post or put requests with payload, but I haven't understand how to add payload to request. What method or property I have to use to insert the payload?
Asked
Active
Viewed 1,197 times
1 Answers
2
There is an example there in their repo:
https://github.com/mcollina/node-coap/blob/master/examples/req_with_payload.js
var req = coap.request('coap://localhost/Matteo')
var payload = {
title: 'this is a test payload',
body: 'containing nothing useful'
}
req.write(JSON.stringify(payload));

eugene-nikolaev
- 1,290
- 1
- 13
- 21