tuya / tuya-connector-nodejs

nodejs sdk
39 stars 18 forks source link

Issue in passing comma separated values in query TuyaContext.request #2

Closed jj-theInvincible closed 3 years ago

jj-theInvincible commented 3 years ago

This code says Invalid token:

let deviceIdArray = ["someid","someOtherId"]
let deviceList = deviceIdArray.join()
let statusResponse=  await tuya.request({
            path: `/v1.0/iot-03/devices/status`,
            method: 'GET',
           query:{
              device_ids: deviceList
        });

And this one works:

let deviceIdArray = ["someid","someOtherId"]
let deviceList = deviceIdArray.join()
let statusResponse= await tuya.request({
            path: `/v1.0/iot-03/devices/status?device_ids=${deviceList}`,
            method: 'GET',
        });`

Ideally, both imply same things, but looks like the query formation has some issue, using v2.0.2

Erchoc commented 3 years ago

Are you sure the second one will work properly?

you can upgrade to v2.0.6, the path parse err will be fixed.