javascript/Json Nfetch 'PUT' req not working

HI there!

I am trying to send Json data through NFetch, it work finw with the ‘POST’ req,
but when i change the req to ‘PUT’, seem like the testPutJSONResponse function is not running,
no data is upload to server and ‘POST JSON success’ is not shown in notch log too.

*i only now testing in notch editor environment

Could someone please help me !!! THanks!!!

Below is the code:

function Update()
{

payload = {
“mydata”: “is awesome”,
“myNumber”: 42
}

req = { method: ‘PUT’, body: JSON.stringify(payload), headers: { ‘Content-Type’: ‘application/json’ } };
NFetch(“Myserverlink/” + “userName”+ “.json”, req, testPutJSONResponse);

Log(‘test’);

}

function testPutJSONResponse(response) {
if (response.ok && response.status === 200) {
Log(‘POST JSON success’);
}
}

Do you have the scene playing back in builder? I think builder needs to be playing for NFetch to work.

– Ryan

@ryan.notch

Yes , i was playing back at the builder while testing the javascript, it work with the nfetch ‘post’ function , just not working when I change it to ‘put’.

have u test the Nfetch ‘post’ function before? or is there sth i wrote wrong for the code?

Sorry for the delay - it looks like put requests aren’t supported at present. Will talk to the dev team and see if it can be looked into in future.

– Ryan